I have a .csv file that will be generated frequently and named using timestamp. I need to run a macro in it and update the .csv file. I used this solution Run Excel Macro from Outside Excel Using VBScript From Command Line for running my macro, but my problem is I'm unable to save the .csv file without the macros enabled in it and the changes being saved in it. I have only one sheet of the csv file. Thanks for the help! This is the code I'm using, (got from that link):
Dim oFSO
Dim oShell, oExcel, oFile, oSheet
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
Set oExcel = CreateObject("Excel.Application")
Set wb2 = oExcel.Workbooks.Open("D:\.....\PERSONAL.XLSB") 'Specify foldername here
oExcel.DisplayAlerts = False
For Each oFile In oFSO.GetFolder("D:\..\Output1\").Files
If LCase(oFSO.GetExtensionName(oFile)) = "csv" Then
With oExcel.Workbooks.Open(oFile, 0, True, , , , True, , , , False, , False)
oExcel.Run wb2.Name & "!final1"
End With
End If
Next