Getting a little closer to having this working (thanks for the previous
ideas!)
I now find that if I pass in my second argument to this code:
Option Explicit
Dim objArgs
Set objArgs = WScript.Arguments
Sub CallExcelMacro(strPath, strEName, strMacro)
Dim objXL
Set objXL = WScript.CreateObject("Excel.Application")
objXL.WorkBooks.Open strPath & strEName
objXL.Visible = FALSE
objXL.Run(strMacro)
objXL.Quit
Set objXL = Nothing
End Sub
Call CallExcelMacro(objArgs(0), objArgs(1), objArgs(2))
so that it's longer than 15 characters, then the script won't run.
Ironically, the strPath variable is longer and doesn't seem to cause any
problem. (So maybe it's something else?)
The code that works (by renaming my spreadsheet to accomodate, which isn't a
long term option) from my other (SAS) program that calls this is:
rc = system('cscript.exe //nologo
"\\inlrc11\abc\mets\general\CallExcelMacro.vbs"
"\\inlrc11\abc\temp\state excel\"
"ST Weekly 70170.xls"
"LoadData"');
(The system function basically calls cscript in command line fashion.)
However, the following bombs:
rc = system('cscript.exe //nologo
"\\inlrc11\abc\mets\general\CallExcelMacro.vbs"
"\\inlrc11\abc\temp\state excel\"
"ST Weekly 701709738.xls"
"LoadData"');
Any thoughts on why the longer Excel filename causes this to bomb? Probably
something dumb I'm doing, but this isn't my main language. Again, many
thanks!