I have a vbs file that pulls information from my database and exports the data to an Excel file (C:\file.csv). Once this is done, I run a series of macros (vba) to format this data. These macros are always the same, I normally copy/paste them over from a text file into the spreadsheet and then manually run them.
Is there a way I can include the macro vba to the vbs file so, after the data is exported to the spreadsheet, the macros run? Similar solutions show how to call a pre-defined macro in an Excel file, where I want the contents of the macro to be saved/executed in/from my vbs file. This will be helpful since the vbs is creating a brand new file, then would run formatting macros.
My thought is I'll need to use Set objWorkbook = objExcel.Workbooks.Open("C:\file.csv")