Ask Your Question
1

Create a macro that runs other macros [closed]

asked 2012-06-05 22:50:58 +0100

naomibrown gravatar image

Hi,

I've recorded some macros and now want to have them all run one after another. Is this possible?

Thanks, Naomi

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-16 15:14:51.747641

1 Answer

Sort by » oldest newest most voted
1

answered 2012-06-06 10:57:35 +0100

JohnSUN gravatar image

Of course it possible! Just write a new procedure, which will cause the old macros in the right order. You can use the Call statement or simply specify the name of an existing macro. For example, as follows:

Sub myOldMacro1()
...
End Sub

Sub myOldMacro2()
...
End Sub

Sub totalСall
  Call myOldMacro1()  ' With Call statement
  For i = 1 to 10
    myOldMacro2()     ' Without Call statement
  Next i
  myOldMacro1()       ' Without Call statement again
End Sub

Every one of your old macros must have a unique name (to know the Basic which of macro is invoked in each case).

edit flag offensive delete link more

Comments

Thanks! I've got it done now :)

naomibrown gravatar imagenaomibrown ( 2012-06-07 12:04:06 +0100 )edit

Question Tools

1 follower

Stats

Asked: 2012-06-05 22:50:58 +0100

Seen: 3,856 times

Last updated: Jun 06 '12