Helge Larsen
New Member
- Joined
- Sep 22, 2008
- Messages
- 19
I need some VBA like this:
Dim AllSubs(1 To 3) As String
Sub myMAIN()
Sub Call_VBA(ByRef I As Integer)
Sub Sub1(): MsgBox "Sub1": End Sub
Sub Sub2(): MsgBox "Sub2": End Sub
Sub Sub3(): MsgBox "Sub3": End Sub
Is it at all possible to make a such 'dynamic' call of a VBA routine.
Dim AllSubs(1 To 3) As String
Sub myMAIN()
AllSubs(1) = "Sub1"
AllSubs(2) = "Sub2"
AllSubs(3) = "Sub3"
Call Call_VBA(2) ' This should call Sub2.
End SubAllSubs(2) = "Sub2"
AllSubs(3) = "Sub3"
Call Call_VBA(2) ' This should call Sub2.
Sub Call_VBA(ByRef I As Integer)
Dim mySub As String
mySub = AllSubs(I)
Call mySub ' Of course this will not function!
End SubmySub = AllSubs(I)
Call mySub ' Of course this will not function!
Sub Sub1(): MsgBox "Sub1": End Sub
Sub Sub2(): MsgBox "Sub2": End Sub
Sub Sub3(): MsgBox "Sub3": End Sub
Is it at all possible to make a such 'dynamic' call of a VBA routine.