datastarstar
asked on
How to return VBA function value to VBScript
This will work, where Report is an Excel macro (subroutine) and I pass 2 parameters to it:
xlApp.Run "Report", CStr(StartCount), CStr(EndCount)
But if Report is a function, and I want it to return a value to the VBScript, I can't get it to work. Have tried variations of this:
ReturnValue = xlApp.Run "Report", CStr(StartCount), CStr(EndCount)
I get an "expected end of statement" error right before "Report"
???
xlApp.Run "Report", CStr(StartCount), CStr(EndCount)
But if Report is a function, and I want it to return a value to the VBScript, I can't get it to work. Have tried variations of this:
ReturnValue = xlApp.Run "Report", CStr(StartCount), CStr(EndCount)
I get an "expected end of statement" error right before "Report"
???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That was easy -- ran without error. I thought I tried every combination of quotes, parentheses, etc.
Thank you!
Thank you!
Great, glad it was that simple.
~bp
~bp
ASKER
Set xlApp = CreateObject("Excel.Applic
xlApp.DisplayAlerts = False
Set xlBook = xlApp.Workbooks.Open("h:\t