rabindrasaha
Programmer
Hi
Problem statement :
I have one MS Excel workbook in which one sheet has a column called "Function Name". That column stores the function names. Those functions vb script functions and are defined in one external .vbs file.
Now I am writing a driver script (.vbs file) which will open that excel sheet and read that column to get function name and then call the correcponding function.
I am having trouble to call a vb function whose name itself is a variable that gets filled in at run time after reading the excel sheet.
Here is the code snippet.
-----------------------------------------------------------
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Project\Company\Controller\input.xls")
intRow = 2
functionName ="test1"
Do Until objExcel.Cells(intRow,1).Value = ""
if ((objExcel.Cells(intRow, 4).Value = "Y") Or (objExcel.Cells(intRow, 4).Value = "Yes")) then
functionName = objExcel.Cells(intRow, 3).Value
Wscript.Echo (functionName)
Call functionName
end if
intRow = intRow + 1
Loop
objExcel.Quit
-----------------------------------------------------------
I know how to call a function defined in some other .vbs file, but problem is how to call a function whose name itself is a variable.
Any help would be highly appreaciated.
Thanks
Rabi
Problem statement :
I have one MS Excel workbook in which one sheet has a column called "Function Name". That column stores the function names. Those functions vb script functions and are defined in one external .vbs file.
Now I am writing a driver script (.vbs file) which will open that excel sheet and read that column to get function name and then call the correcponding function.
I am having trouble to call a vb function whose name itself is a variable that gets filled in at run time after reading the excel sheet.
Here is the code snippet.
-----------------------------------------------------------
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Project\Company\Controller\input.xls")
intRow = 2
functionName ="test1"
Do Until objExcel.Cells(intRow,1).Value = ""
if ((objExcel.Cells(intRow, 4).Value = "Y") Or (objExcel.Cells(intRow, 4).Value = "Yes")) then
functionName = objExcel.Cells(intRow, 3).Value
Wscript.Echo (functionName)
Call functionName
end if
intRow = intRow + 1
Loop
objExcel.Quit
-----------------------------------------------------------
I know how to call a function defined in some other .vbs file, but problem is how to call a function whose name itself is a variable.
Any help would be highly appreaciated.
Thanks
Rabi