Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Macro List in VBA Code Window (2000 SR1)

    Don't know if anyone ever found this, so here's a tip that I stumbled on that might be useful to people with VBA.

    When looking at a code window for a module, you might want to get to another module to edit or even run a macro/sub in that other module.

    One way of doing this is to go to the project explorer and open the code window for the other module. Of course, you may have to scroll in the project window and expand the module selection to get at the module you want. Once there, you have to open the code window for the module.

    It is also known that clicking the run button (or doing the same from the menu) while inside a sub will run the sub.

    However, if you click the run button while outside any sub (eg, while the cursor is on an Options statement), this will bring up Word's Macro window (same as Tools - Macro - Macros or Alt+F8 in Word). The macros shown will depend on what project you were in when you clicked. But you can click the Macros In: drop down and choose All Active Templates and Documents. If you now select a macro, you can edit that macro (as long as the module is viewable/editable). Clicking the Edit button scrolls the Project window to that module, selects the module, and opens its code window positioned at the macro/sub you selected. If you click the Run button, the macro will be run (but the Project window will stay where it was when you started this).

    This also seems to work if you click Run while the cursor is after the last End statement in a module (whether in Procedure view or Full Module view). However, here the macro sometimes ran and sometimes gave me the above. Haven't figured out a pattern for this yet.

    This saves a little time if you forget where you put that macro/sub that you now want to jump to for editing or running.

    HTH.

    Fred

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro List in VBA Code Window (2000 SR1)

    <img src=/S/thewave.gif border=0 alt=thewave width=225 height=33>
    I'm organized enough to organize my macros in several modules, but not enough to remember which one they're in...

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15> Klaus

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Macro List in VBA Code Window (2000 SR1)

    Hi Klaus,

    Of course, you realize this discovery was purely an accident. I had meant to click inside a sub and then run it. Not realizing my cursor was not in any sub, I clicked run anyway and the rest is history.

    Glad this was of use to someone.

    Fred

  4. #4
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro List in VBA Code Window (2000 SR1)

    > Of course, you realize this discovery was purely an accident.

    I bet Columbus said just the same.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

Posting Permissions

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