none
I want a single macro to run multiple macros RRS feed

  • Question

  • I want a macro which will help me run a set of multiple macros at one time. instead of running all the 5 macros one after another




    • Edited by ALI74 Wednesday, December 19, 2012 12:03 PM
    • Edited by Cindy Meister MVPModerator Thursday, December 27, 2012 5:38 AM restoring original question
    Monday, December 17, 2012 3:18 PM

Answers

  • You can create a new macro:

    Sub RunAll()
        Call Macro1
        Call Macro2
        Call Macro3
    End Sub

    You can add as many lines as you need. Execute the RunAll macro to run all macros mentioned in it.

    Regards, Hans Vogelaar

    • Marked as answer by ALI74 Monday, December 17, 2012 5:57 PM
    • Unmarked as answer by ALI74 Wednesday, December 19, 2012 12:00 PM
    • Marked as answer by Cindy Meister MVPModerator Thursday, December 27, 2012 5:39 AM
    Monday, December 17, 2012 3:50 PM
  • Yes, the subs should be below each other. The order doesn't matter - RunAll can be above TwoSpaces or below the End Sub of P2.

    Sub RunAll()
        Call TwoSpaces
        Call P2
    End Sub


    Regards, Hans Vogelaar

    Monday, December 17, 2012 4:53 PM

All replies

  • You can create a new macro:

    Sub RunAll()
        Call Macro1
        Call Macro2
        Call Macro3
    End Sub

    You can add as many lines as you need. Execute the RunAll macro to run all macros mentioned in it.

    Regards, Hans Vogelaar

    • Marked as answer by ALI74 Monday, December 17, 2012 5:57 PM
    • Unmarked as answer by ALI74 Wednesday, December 19, 2012 12:00 PM
    • Marked as answer by Cindy Meister MVPModerator Thursday, December 27, 2012 5:39 AM
    Monday, December 17, 2012 3:50 PM
  • Sir , Thanks for the quick reply...  But I am confused. Kindly help me with example of two macros ( i have pasted two macros Macro 1 - Sub TwoSpaces & Macro 2 - Sub P2() below.

    How will it run in one macro. whether all the macros should be placed below the Sub RunAll()  simultenously one below the other

    Sub TwoSpaces()
        With ActiveDocument.Content.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .MatchWildcards = True
            .Execute FindText:="([.,\?\!]) {1,}", ReplaceWith:="\1", Replace:=wdReplaceAll
            .Execute FindText:="([.,\?\!])", ReplaceWith:="\1  ", Replace:=wdReplaceAll
        End With
    End Sub


    Sub P2()
    '
    ' P2 Macro
    '
    '
        Options.CheckGrammarWithSpelling = False
        ActiveWindow.View.ShowTextBoundaries = True
        Options.CheckSpellingAsYouType = False
    End Sub

    Monday, December 17, 2012 4:47 PM
  • Yes, the subs should be below each other. The order doesn't matter - RunAll can be above TwoSpaces or below the End Sub of P2.

    Sub RunAll()
        Call TwoSpaces
        Call P2
    End Sub


    Regards, Hans Vogelaar

    Monday, December 17, 2012 4:53 PM
  • Thank you



    Ali,

    Please reinstate your first post's original content. Without it you have destroyed the context for the rest of the thread.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Wednesday, December 19, 2012 11:32 AM
  • Thank you



    Ali,

    Please reinstate your first post's original content. Without it you have destroyed the context for the rest of the thread.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Wednesday, December 19, 2012 11:33 AM
  • Hi ALI74,

    It will be nice if you could reinstate the original post and mark the most helpful replies.

    Thanks in advance for your time and effort.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 25, 2012 5:00 AM
    Moderator
  • HI,

    I wanted a macro which will help me run a set of multiple macros at one time. instead of running all the 5 macros one after another


    ALI

    Wednesday, December 26, 2012 5:11 PM