Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Sep 2003
    Location
    Camp Springs, Kentucky, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro from Macro using Shortcut (Excel 2002/SP2)

    I've created a macro (macro1) that calls another macro (macro2) and as long as I run the first macro (macro1) from the "Macro" form, it works fine. If I create a shortcut for macro1, it won't run the second macro.

    Can anyone explain this difference in behavior?

    Thanks,
    Joe

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro from Macro using Shortcut (Excel 2002/SP2)

    What shortcut do you use:

    - a hotkey
    - a button on a sheet from the control toolbox
    - a button on a sheet from the forms bar
    - a toolbar button

    What error do you get

    Can you show us the code?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro from Macro using Shortcut (Excel 2002/SP

    Could you possibly give us a little bit more information:<UL><LI>In which workbook(s) are the Macros? <LI>How are you setting up the shortcut? <LI>Is this code always going to be run in the same (type of) file? <LI>Have you considered using a custom toolbar for your shortcut?[/list]HTH
    Gre

  4. #4
    Lounger
    Join Date
    Sep 2003
    Location
    Camp Springs, Kentucky, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro from Macro using Shortcut (Excel 2002/SP2)

    macro2 formats some cells in a spreadsheet and copies some cells.
    macro1 opens a tab delimited file using a filename from a cell in the current spreadsheet, runs macro2, pastes the cells that were copied from macro2, then saves the tabl delimited file as as an Excel spreadsheet and closes it.

    The shortcut that I am using is a "Shortcut key" as defined in the "Macro Options" form.

    macro2 runs fine with a shortcut key, but if I run macro1 with a shortcut key, it gets to the point where the tab delimited file is opened and then it stops and macro2 is never executed. If I run macro1 from from "Tools, Macro, Macros, Run", it works fine.

    Thanks

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Macro from Macro using Shortcut (Excel 2002/SP2)

    Have you set the shortcut key to the wrong macro?

    It shouldn't matter how a macro is called, which makes me suspect that you may have the shortcut not running the macro you suspect.

    Steve

  6. #6
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro from Macro using Shortcut (Excel 2002/SP

    I would set this up to run from my Personal.xls. Is that what you are doing? Can you post the code? (You might wish to use the <!t>[pre]<!/t> and <!t>[/pre]<!/t> tags around your code when postiung - to preserve indentation.) HTH
    Gre

Posting Permissions

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