Link to home
Start Free TrialLog in
Avatar of JustinW
JustinWFlag for United States of America

asked on

Evaluate String as a sub Routine

I have a string that represents a method I want to execute
on an object inside of a public dictionary object.

Normally the way I'd work with this, is to
do the following:

sub Delete_Asset()
      dFORMS("Assets").delete_
end sub

Open in new window


However, I have SomeFunction,
which gives me the code I need to run
instead:

sub Button_Click()
dim s as string

let s = SomeFunction()
debug.print s
Application.Eval s
end sub

Open in new window


when I run this, debug.print gives:
 dFORMS("Assets").delete_

Open in new window


and then it blows up because it can't evaluate it.
How do I get this to work?
ASKER CERTIFIED SOLUTION
Avatar of JustinW
JustinW
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial