Try,
Dim Result
Result = objXL.Run("test")
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"None" wrote in message
...
Hello
Suppose I have an Excel workbook named Book1.xls. Within this
workbook, there is a Module1 and within it, is the following
function:
function getValue(sym as String)
begin
//processing code..
getValue = 10
end
How can I call this function from a Windows Scripting Host
(WSH) script?
I have tried the following but I receive an error with the
message "Subscript out of range"
Dim ObjXL
Dim tmp
Dim Range
Set ObjXL = WSCript.CreateObject("Excel.Application")
ObjXL.Visible = true
objXL.WorkBooks.Open("C:\Book1")
Set tmp = ObjXL.Modules("Module1").getValue("hello")
//I have also used Modules(0) and Modules(1)
WScript.Echo tmp
Any help or hints is greatly appreciated.