I have a VB Script which runs correctly, however, inside the loop of spreadsheets, it seems to wait for the macro of the current spreadsheet to run before opening up the next spreadsheet and kicking off that macro. Is there a way to run them all at once instead of say file2 having to wait for file 1 to open and run? The code is below.
Dim xlApp
Dim xlBook
Dim f
Dim curfile
Dim username
Dim password
' Prompt user for credentials
username = InputBox("Enter your username")
password = InputBox("Enter your password")
Set fso = CreateObject("Scripting.FileSystemObject")
Set xlApp = CreateObject("Excel.Application")
xlApp.DisplayAlerts = False
For f = 1 to 3
Set xlBook = xlApp.Workbooks.Open(fso.GetParentFolderName(WScript.ScriptFullName) & "\full_volume" & f & ".xlsm", 0, True)
' Paste in credentials to current spreadsheet
xlBook.Sheets("Main").Cells(2,5).Value = username
xlBook.Sheets("Main").Cells(3,5).Value = password
xlApp.Application.Visible = True
xlApp.Run "batch_calc"
' Close Excel File
' xlApp.Quit
Set xlBook = Nothing
Next
Set xlApp = Nothing
WScript.Echo f & " Batch Files Finished"
WScript.Quit