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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IsCompiled equivalent for Excel VBA

Status
Not open for further replies.

DeeBeeGee

Programmer
Sep 28, 2004
21
0
0
GB
I am trying to write a solution to addressing variables using a string equivalent of their name much like using a key to refer to a member of a collection but without the collection.
The way I have succeeded in doing this is creating a temporary sub at runtime, calling it, then deleting it and this works fine. What I wish to do is to only call the temporary sub if it compiles as if it doesnt it will cause a nasty error since the remaining code that deletes the temporary module will not be run
I hear that something exists for Access but can find nothing for Excel
Any help would be an early xmas present
 
Why not using a Scripting.Dictionary object if you don't like Collection ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PH

I have nothing against collection at all. However there is no need to group together my variables and in some cases there may only be just the one in which case a dictionary (or a collection) would be superfluous and messy*
I have usefully used the dictionary in such a way before but I am currently amending a existing program and it would be useful not to have to go through all the code changing variable names to dictionary keys.

What I have now is fine for my needs as I know the code which invokes my 'temporary sub' will compile properly. I am trying to make it available to other users which generally means making it foolproof hence my desire for it to check itself for compile errors

*disclaimer - my method is potentially both of these things also :eek:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top