Launch Excel from DOS Batch file and tell it to run Macro???

  • I need to edit a .csv file which is generated from another program.
    What I do now is have a DOS batch file which runs the program to generate the file then opens the file in excel.


    I then manually run a macro to format/sort the data.


    How can I automate the step to run the macro?
    Wasn't there at one time a commandline switch to specify a macro?


    Any help would be appreciated.


    - MM

  • I have received the same reply on many forums but....


    The .csv file generated by a separate program is NOT an excel file and can NOT have macros/events.


    I am not converting to excel, I am editing a .csv file then resaving as a .csv


    My question is specifically aimed at externally (DOS Batch file) telling Excel to open a .csv file and then run a macro defined in the personal.xls (Personal workbook)

  • Try creating an Excel file to open after the CSV file. Your batch script would work as follows:


    ...
    Open MyFile.csv with Excel
    Open MyUtility.xls with Excel
    ...


    MyUtility.xls could contain the Auto_Open macro to perform the necessary work on MyFile.csv.


    bgano

  • Thanks




    Thanks, I give that a try.
    I was hoping there was a way to call a macro from the commandline via a startup switch
    .

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!