Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In VBA, is there a way to call a function by string value?

For example -

Dim function_name, value1, value2 as String

value1 = "test"
value2 = "Function"
function_name = value1 & value2 ' So function name = 'testFunction'

call function_name ' But this calls a function called 'function_name', where as I require a funtion called 'testFunction'
share|improve this question
up vote 2 down vote accepted

Try using Application.Run to call it.

Application.Run function_name

share|improve this answer
Run, that's the bad boy. Thanks for the help. – David Gard Oct 18 '12 at 15:21

Or check out CallByName from VBA itself. VB looks a little dated but it is the promise of COM realized.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.