We cannot use GetRef when we have the required function call in different library ( Example if we have a sample function with name "TestEval" in a different library apart from where we have called GetRef to the function "TestEval". it will not work). we cannot use GetRef as it expects the function within its scope in the current library
On other hand Eval will work irrespective of where your Function is placed in library ( provided your library is associated to your test)
Example of using EVAL using multiple parameters:-
msg1 = "Hi "
msg2 = "Readers "
FunctionName = "TestEval"
Call Eval(FunctionName & chr(40) & "msg1" & chr(44) & "msg2" & chr(41))
Function TestEval(byval firstmessage, byval SecondMessage)
msgbox firstmessage
msgbox SecondMessage
message = firstmessage & " " & SecondMessage
msgbox message
End Function
Example of using GetRef using multiple parameters:-
msg1 = "Hi "
msg2 = "Readers "
FunctionName = "TestEval"
Call GetRef(FunctionName)(msg1,msg2)
Function TestEval(byval firstmessage, byval SecondMessage)
msgbox firstmessage
msgbox SecondMessage
message = firstmessage & " " & SecondMessage
msgbox message
End Function
On other hand Eval will work irrespective of where your Function is placed in library ( provided your library is associated to your test)
Example of using EVAL using multiple parameters:-
msg1 = "Hi "
msg2 = "Readers "
FunctionName = "TestEval"
Call Eval(FunctionName & chr(40) & "msg1" & chr(44) & "msg2" & chr(41))
Function TestEval(byval firstmessage, byval SecondMessage)
msgbox firstmessage
msgbox SecondMessage
message = firstmessage & " " & SecondMessage
msgbox message
End Function
Example of using GetRef using multiple parameters:-
msg1 = "Hi "
msg2 = "Readers "
FunctionName = "TestEval"
Call GetRef(FunctionName)(msg1,msg2)
Function TestEval(byval firstmessage, byval SecondMessage)
msgbox firstmessage
msgbox SecondMessage
message = firstmessage & " " & SecondMessage
msgbox message
End Function
No comments:
Post a Comment
Note: only a member of this blog may post a comment.