Here is a bit more of a detailed example than I provided in my initial response. Granted, the task I'm having the macro do is a bit silly but I wanted to keep it as simple as possible.
In the folder "C:\Test" I create the workbook, "wkbk1.xls". In this workbook, I create a macro that is shown immediately below:
'------------------------------------
Sub myMacro(Optional myArg As String = "")
Cells(1, 1).Value = myArg
End Sub
'------------------------------------
All this macro does is to take a string argument and place the text string in cell A1 of the active sheet. If no argument is given to the sub when it launches, a zero length string is the value of cell A1.
I make the folder "C:\Test" a trusted location so the macro can run without warnings that require user intervention.
On my desktop which is "C\Users\Steve\Desktop" I create a new text file that I name "RunXLmacro.vbs" The contents of this text file with a vbs extension are immediately below:
'----------------------------------
Select Case Date
Case "9/6/2010"
WScript.Quit
Case "10/11/2010"
WScript.Quit
Case "11/25/2010"
WScript.Quit
Case "11/26/2010"
WScript.Quit
Case "12/27/2010"
WScript.Quit
End Select
arg1 = WScript.Arguments(0)
Set objXL = CreateObject("Excel.Application")
objXL.Workbooks.Open("C:\Test\wkbk1.xls")
objXL.Run "myMacro", CStr(arg1)
objXL.ActiveWorkbook.Save
objXL.ActiveWorkbook.Close
objXL.Quit
'----------------------------------
What the script is supposed to do is first check if the date today is Labor Day, Veteran's day, Thanksgiving or Christmas holiday and quit if it is a holiday. If not, it retrieves the first command line argument presented to the script. Finally, it opens
Excel, opens the workbook wkbk1.xls, runs the macro named 'myMacro" giving it whatever command line argument it received and then saves and closes the workbook.
Finally, I set up the command line to launch the script in Windows Task Scheduler, or for testing I just pressed the Windows key and letter 'r' to get the Run line and entered the command line:
WScript.exe "C:\Users\Steve\Desktop\RunXLmacro.vbs" "cat"
This uses the executable WScript.exe to launch the vbScript and presents the word "cat" as a command line argument. Now, if I go and open C:L\Test\wkbk1.xls, I will find the word "cat" in cell A1 on Sheet1.