Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 1 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
2  

Your Answer

 
discard

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.