Search code examples
filesortingbatch-fileusing

Open excel file and sort contents using a Batch file commands


I am looking for a code that can be written that would open excel and sort a field within the opened workbook.

A thought would be to:

set the workbook to run a vba sorting script on open 
start Excel.exe filename.xls

Would this be a viable option? If so, how would I initiate the vba script on open?


Solution

  • Show only the files which contains "PRE100" in the file name:

    @echo off
    
    For %%f in (SOURCE_PATH\*PRE100*.*) do Echo %%f 
    

    Move only the files which contains "PRE100" in the file name, to another dir:

    @echo off
    
    For %%f in (SOURCE_PATH\*PRE100*.*) do Move %%f DESTINY_PATH
    

    Change SOURCE_PATH and DESTINY_PATH to what you need.