Make OnAction refer to a macro in a specific file



I'm having the same problem as Richard below.

I have a sub that creates a list of boilerplate documents from
filenames in a folder. The Onaction calls another sub that creates a
new document and inserts the boilerplate in it.

The problem is that the Onaction only runs properly when the document
with the macro is the active document. Since that document is a
global addin, I'd like to be able to run the macro from ANY document
that's open.

I too am having trouble finding out:
A) Is it possible to run Onaction macros from other documents, and if
so

B) What is the best syntax to put in the Onaction statement?

Word 2003 on WinXP Pro SP2.

Thanks!
- - - - - - - - - - - - - - -

1. richardcranfordnospam View profile
More options Mar 17 2003, 2:28 pm

I'm working on a prototype for a Word application that
will generate boilerplate letters. The application adds an
option to the menu when it's opened. When you select the
new menu option, then a suboption, the macro opens a new
file and writes a letter. The addition to the menu stays
in place, but it ceases to work unless the document
containing my macros is in the active window. I think what
I want is to have the OnAction statement refer explicitly
to the macro, including the file name, but I'm having
trouble finding the right syntax for that. Any ideas?

TIA

--Richard
.



Relevant Pages

  • Re: .onaction, passing arguments
    ... Theoretically, if a macro can be called by .onaction = stuff, or by ... another sub, keeping the control testing out of that macro makes it more ... In my app it's prudent to control several worksheet, ws, processes, ...
    (microsoft.public.excel.programming)
  • Re: Shape.OnAction stops working after workbook closed and re-opened
    ... the workbook it stops working and my OnAction code line results in ... It sounds like the OnAction is working fine and triggering the macro, ... Save the workbook, reopen and try again. ...
    (microsoft.public.excel.programming)
  • Re: .onaction, passing arguments
    ... If so, you think it's a crappy idea to pass their value via onaction, but ... Theoretically, if a macro can be called by .onaction = stuff, or by ... another sub, keeping the control testing out of that macro makes it more ... In my app it's prudent to control several worksheet, ws, processes, ...
    (microsoft.public.excel.programming)
  • Re: Renamed module, now toolbar buttons dont work.
    ... I was trying to use OnAction but it returned an empty string. ... Bruno ... > Look up OnAction in Word VBA help. ... >> way to change the macro name associated with the button. ...
    (microsoft.public.word.vba.general)
  • Re: Make OnAction refer to a macro in a specific file
    ... If you use just the macroname, the macro will only run if the calling ... OnAction = "mymodule.mymacro" ... I have a sub that creates a list of boilerplate documents from ... will generate boilerplate letters. ...
    (microsoft.public.word.vba.general)