Jump to content
Sign in to follow this  
newcoder1010

How to call method

Recommended Posts

Hello,

I have this function to launch the application:

Public Function OpenApplication(exePath)
        SystemUtil.Run exePath

OpenApplication = 1
End Function

'Calling the function works.

url = "examplesite.com"

aa = OpenApplication(url)

'Instead of calling from the script, I would like to move the function and parameter in excel. So, in excel, I have two columns: method and parameter

My script goes to excel, read the method and parameter then make the call. I get type mismatch error at the last line myMethod(myParam).

	myMethod = SheetOne.Cells(2, 3)
	myParam = SheetOne.Cells(2, 4)
	myMethod(myParam)

Please advise. 

Edited by newcoder1010

Share this post


Link to post
Share on other sites

myMethod just contains a string, it's not a function.  It looks like you can use GetRef to get the function by name.  e.g.:

f = "OpenApplication" 
	func = GetRef(f)
	func(url)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×