?
Solved

Call a function by address

Posted on 2003-03-19
6
Medium Priority
?
138 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: 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!

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 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