Macro to run a Macro

K

Kevin

I have several macros that I want to have executed from a single macro.
I'm used to excel VB where I would just say application.run "Macro1"
But that just returns object does not support this method.

Any help is appreciated...
 
J

John

Hello Kevin,

You need another macro to run the others. So for example:

Public Sub MyCallingProcedure()
Call MyCalledProcedure1
Call MyCalledProcedure2("a useful argument")
End Sub

Private Sub MyCalledProcedure1()
MsgBox "MyCalledProcedure1 was called"
End Sub

Private Sub MyCalledProcedure2(ByRef _
strUsefulArgument As String)
MsgBox "MyCalledProcedure2 was called and was passed " _
& strUsefulArgument & "."
End Sub

Hope that helps.

Best regards

John
 
K

Kevin

Perfect, thank you!!!

John said:
Hello Kevin,

You need another macro to run the others. So for example:

Public Sub MyCallingProcedure()
Call MyCalledProcedure1
Call MyCalledProcedure2("a useful argument")
End Sub

Private Sub MyCalledProcedure1()
MsgBox "MyCalledProcedure1 was called"
End Sub

Private Sub MyCalledProcedure2(ByRef _
strUsefulArgument As String)
MsgBox "MyCalledProcedure2 was called and was passed " _
& strUsefulArgument & "."
End Sub

Hope that helps.

Best regards

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top