venkies2
11 years agoNew Contributor
How to call a function in VB script. The function name is in some variable.
I have excel sheet in which contains list of all functions in one of the column (FunctionName) as shown below.
Script created in such a way that it takes function name and parameters into one variable. After taking into one variable am using to call with call statement. But it not working.
While MainrsObj.EOF<>True
cnt=0
If (MainrsObj.Fields("Flag"))="Yes" Then
For i=1 to 10
If (MainrsObj.Fields("Parameter"&i))<>"" Then
ReDim preserve Parameters(cnt)
Parameters(cnt)=chr(34) &MainrsObj.Fields("Parameter"&i)&chr(34)
else
Exit For
End If
cnt=cnt+1
Next
totParameters=join(Parameters,",")
'msgbox totParameters
FunctionName=cstr(MainrsObj.Fields("FunctionName")) &" "&totParameters
call FunctionName
TestCase | FunctionName | Flag | Parameter1 | Parameter2 | Parameter3 |
Scenario | login | Yes | http://xyz.com | ||
Scenario1 | search | Yes | pen | paper |
Script created in such a way that it takes function name and parameters into one variable. After taking into one variable am using to call with call statement. But it not working.
While MainrsObj.EOF<>True
cnt=0
If (MainrsObj.Fields("Flag"))="Yes" Then
For i=1 to 10
If (MainrsObj.Fields("Parameter"&i))<>"" Then
ReDim preserve Parameters(cnt)
Parameters(cnt)=chr(34) &MainrsObj.Fields("Parameter"&i)&chr(34)
else
Exit For
End If
cnt=cnt+1
Next
totParameters=join(Parameters,",")
'msgbox totParameters
FunctionName=cstr(MainrsObj.Fields("FunctionName")) &" "&totParameters
call FunctionName