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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...