-
Solved: calling a function according to a value in a variable
as i said in my previous post i'm relatively new to VBA, and so i have a lot of questions...
the background:
i'm building a tool where my users can do several magical things to an excel workbook full of addresses. One of the important requirements is extensibility, and that means that i should be able to add new 'filters' quickly.
Therefore i want to define all the 'filters' in a separate worksheet.
One of the elements in a filter-definition is which vba function should be called, and which arguments should be passed to that function.
can anyone tell me how to evaluate a variable so it becomes a function name?
example:[VBA]
dim functionName = string
functionName = "doSomething"
activesheet.functionName("and some arguments here")
sub doSomething(theArgument as string)
activeCell.value = theArgument
end sub
[/VBA]
I hope you understand what i am trying to accomplish, and if you could tell me how i can get it to work, that would be great!
-
[vba]
Sub BeginItAll()
Dim functionName As String
functionName = "doSomething"
Application.Run functionName, "and some arguments here"
End Sub
Sub doSomething(theArgument As String)
MsgBox theArgument
End Sub
[/vba]
-
thanx XLD!
you solved my problem again!
I'm very happy! (untill i run into a new problem, but even then i'll know that somewhere someone has the anwser to all my problems) :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules