Results 1 to 5 of 5
  • Thread Tools
  1. Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,434
    Thanks
    1
    Thanked 1 Time in 1 Post

    Fully Qualify (Word 97 and >)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> Loungers

    How does one fully qualify the OnAction of a ToolBar button entry so that it can tell what macro code to run in MS-Word?

    Thanks

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  2. Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Fully Qualify (Word 97 and >)

    Just use something like

    CommandBars("MyToolbar").Controls("MyControl").OnA ction = "MyMacro"

    If you want to specify the module that contains the macro:

    CommandBars("MyToolbar").Controls("MyControl").OnA ction = "MyModule.MyMacro"

    If you want to call a macro in another template, create a macro in the current template that calls it using Application.Run, and specify the macro in the current template in OnAction.

  3. Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,434
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Fully Qualify (Word 97 and >)

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

    There is no MyDocument level in the "MyModule.MyMacro"?

    Like in MS-Excel ThisWorkbook or MyWorkbook?

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  4. Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Fully Qualify (Word 97 and >)

    Macros are usually stored in standard modules, not in ThisDocument, so there is no need for ThisDocument. Neither would you use ThisWorkbook when assigning OnAction in Excel.

  5. Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Fully Qualify (Word 97 and >)

    To get the preferred syntax, I would drag the macro to the menu bar temporarily, interrogate its properties using the Immediate window, then delete it. Kinda like recording a macro. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Posting Permissions

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