Share via

execute VBA command stored in string

Anonymous
2012-04-29T16:04:39+00:00

In my Excel macro I have a string array containing the names of several SUBs. What is the code for calling the SUB whose name is in an element of that array?

(From somewhere in my programming past I have a memory of a built-in function called EVAL or some such that will do the job. But I cannot seem to find anything resembling it in Excel VBA.)

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-04-29T16:18:46+00:00

Tot run a procedure (sub):

Application.Run "MyMacro"

or

Application.Run arrMacros(3)

where arrMacros is an array of strings, etc.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful