Reputation: 97
I have a batch file that first runs a vbscript to open excel and run a macro. Then it chains 2 other batch files to complete the process. Everything works if I simply double-click on the first batch file and let it run.
When I try to create a windows task scheduler to run the first batch file, it says it completed successfully, but the results of the macro and the other 2 batch files do not get ran/outputted.
First batch file:
REM @ECHO OFF
cscript //nologo "C:\Program Files (x86)\salesforce.com\Data Loader\conf\SaveToCSV.vbs"
Call "C:\Program Files (x86)\salesforce.com\Data Loader\conf\SFDL2.bat"
Call "C:\Program Files (x86)\salesforce.com\Data Loader\conf\SFDL3.bat"
QUIT
.vbs file:
Option Explicit
Dim xlApp, xlBook
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("C:\Program Files (x86)\salesforce.com\Data Loader\conf\VendorManagementReport-Import2.xlsm", 0, True)
xlApp.Run "CopyToCSV"
xlBook.Close False
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
WScript.Quit
I don't think the other 2 batch files are relevant as it never actually creates the .csv file from the .xlsm workbook, which is the first step.
Upvotes: 0
Views: 1035
Reputation: 10715
Try removing the Call
from the first batch file, to start the other two in the same context
REM @ECHO OFF
cscript //nologo "C:\Program Files (x86)\salesforce.com\Data Loader\conf\SaveToCSV.vbs"
"C:\Program Files (x86)\salesforce.com\Data Loader\conf\SFDL2.bat"
"C:\Program Files (x86)\salesforce.com\Data Loader\conf\SFDL3.bat"
QUIT
Upvotes: 0