+ Reply to Thread
Results 1 to 7 of 7

Run a macro within a macro

  1. #1
    norrislaketn
    Guest

    Run a macro within a macro

    How can you execute a macro within another macro.

    Example: Run macro a in macro b. Cutting and pasting does not seem to work.



  2. #2
    Jim Thomlinson
    Guest

    RE: Run a macro within a macro

    Something like this..

    Sub Macro1()
    msgbox "macro1"
    call Macro2
    exit sub

    Sub Macro2()
    msgbox "macro2"
    exit sub


    --
    HTH...

    Jim Thomlinson


    "norrislaketn" wrote:

    > How can you execute a macro within another macro.
    >
    > Example: Run macro a in macro b. Cutting and pasting does not seem to work.
    >
    >


  3. #3
    Gary''s Student
    Guest

    RE: Run a macro within a macro

    Sub hello()
    Call boxit
    End Sub

    Sub boxit()
    MsgBox ("in boxit")
    End Sub
    --
    Gary's Student


    "norrislaketn" wrote:

    > How can you execute a macro within another macro.
    >
    > Example: Run macro a in macro b. Cutting and pasting does not seem to work.
    >
    >


  4. #4
    Trevor Shuttleworth
    Guest

    Re: Run a macro within a macro

    Sub Macro1()
    Msgbox "Macro1"
    ' some code
    Macro2
    End Sub

    Sub Macro2()
    Msgbox "Macro2"
    ' some code
    Macro3
    Macro4
    End Sub

    Sub Macro3()
    Msgbox "Macro3"
    ' some code
    End Sub

    Sub Macro4()
    Msgbox "Macro4"
    ' some code
    End Sub

    Regards

    Trevor


    "norrislaketn" <[email protected]> wrote in message
    news:[email protected]...
    > How can you execute a macro within another macro.
    >
    > Example: Run macro a in macro b. Cutting and pasting does not seem to
    > work.
    >
    >




  5. #5
    norrislaketn
    Guest

    RE: Run a macro within a macro

    Thanks for the info. Your solution will run if I step into it. If I run ir
    directly from the macro shortcut key it does not run. It acts as if it is
    executing the next command before the call is complete. Any other thoughts?

    "Gary''s Student" wrote:

    > Sub hello()
    > Call boxit
    > End Sub
    >
    > Sub boxit()
    > MsgBox ("in boxit")
    > End Sub
    > --
    > Gary's Student
    >
    >
    > "norrislaketn" wrote:
    >
    > > How can you execute a macro within another macro.
    > >
    > > Example: Run macro a in macro b. Cutting and pasting does not seem to work.
    > >
    > >


  6. #6
    norrislaketn
    Guest

    Re: Run a macro within a macro

    Thanks for the info. Your solution will run if I step into it. If I run ir
    directly from the macro shortcut key it does not run. It acts as if it is
    executing the next command before the call is complete. Any other thoughts?


    "Trevor Shuttleworth" wrote:

    > Sub Macro1()
    > Msgbox "Macro1"
    > ' some code
    > Macro2
    > End Sub
    >
    > Sub Macro2()
    > Msgbox "Macro2"
    > ' some code
    > Macro3
    > Macro4
    > End Sub
    >
    > Sub Macro3()
    > Msgbox "Macro3"
    > ' some code
    > End Sub
    >
    > Sub Macro4()
    > Msgbox "Macro4"
    > ' some code
    > End Sub
    >
    > Regards
    >
    > Trevor
    >
    >
    > "norrislaketn" <[email protected]> wrote in message
    > news:[email protected]...
    > > How can you execute a macro within another macro.
    > >
    > > Example: Run macro a in macro b. Cutting and pasting does not seem to
    > > work.
    > >
    > >

    >
    >
    >


  7. #7
    norrislaketn
    Guest

    RE: Run a macro within a macro


    Thanks for the info. Your solution will run if I step into it. If I run ir
    directly from the macro shortcut key it does not run. It acts as if it is
    executing the next command before the call is complete. Any other thoughts?

    "Jim Thomlinson" wrote:

    > Something like this..
    >
    > Sub Macro1()
    > msgbox "macro1"
    > call Macro2
    > exit sub
    >
    > Sub Macro2()
    > msgbox "macro2"
    > exit sub
    >
    >
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "norrislaketn" wrote:
    >
    > > How can you execute a macro within another macro.
    > >
    > > Example: Run macro a in macro b. Cutting and pasting does not seem to work.
    > >
    > >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1