Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Call a function by address

Posted on 2003-03-19
6
Medium Priority
?
140 Views
Last Modified: 2010-05-01
Hi everyone,

Can i call a function by sending it's name as string.
I have the function name in a string variable, can i call it ?

10x
0
Comment
Question by:mosheshitrit
6 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 1000 total points
ID: 8165578
Hi mosheshitrit,

You need to use the CallByName statement:

CallByName Form1,"MyFunction",vbMethod

Have a look in MSDN for more details on the parameters and calling conventions for this statement.

Tim Cottee MCSD, MCDBA, CPIM
http://www.timcottee.tk 

Brainbench MVP for Visual Basic
http://www.brainbench.com

Experts-Exchange Advisory Board Member
0
 
LVL 11

Expert Comment

by:rdrunner
ID: 8165605
Please dont use this to often... I had to debug some software that was using this... EVERYWHERE ..

Its a real pain ;)
0
 
LVL 7

Expert Comment

by:fluglash
ID: 8165617
you also can try CallWindowProc
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:mosheshitrit
ID: 8165709
Hi TimCottee,

Can i use both the form and the function as strings ?

10x
0
 
LVL 11

Expert Comment

by:rdrunner
ID: 8165725
No the Form needs to be an opbject... You can only pass the "function" as a string

But its possible to get the form out of your forms collection for example.... (forms("form1"))
0
 

Author Comment

by:mosheshitrit
ID: 8165831
Thanks, it's working.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question