Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Useing string variables to call internal functions etc.

Status
Not open for further replies.

spiryl

Programmer
Jul 29, 2001
5
AU
HELP!
Is there anyway to use the contents of a string variable to call an internal function or refer to a variable??
eg,

exampleString="exampleFunction(param)"

Function exampleFunction(param AS Any)
<bla bla bla>
End Function

can i use some function/API call to use the contents of exampleString to call any function I want???
PLEASE HELP!
 
Right.....
Perhaps a little more refined answer if possible, sorry.
Thanks
 
I can't do it justice. Type CallByName on any line in the IDE and prsss F1. Then for more information, press the Index tab, enter CallByName and select the entry &quot;Calling a Property or Method Using a String Name&quot; in Visual Basic Concepts. Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Ok thats really usefull thanks! Wasn't aware of that function (just upgraded from VB5).
The CallByName function is all well and good for Forms and Class Modules, but what about standard code modules???
 
I've used that &quot;tip&quot; since VB3. Put your standard module in a class and then have a Sub main in a standard module.

Public sm as clsMyStandardModule
Sub Main
set sm = New clsMyStandardModule
load startupform
End Sub

You will have to qualify all references to members of the &quot;old&quot; standard module.
Now you can use CallByName

Otherwise, you can not use it. Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top