Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Make OnAction refer to a macro in a specific file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
src - 26 Mar 2008 04:19 GMT
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
src - 26 Mar 2008 19:44 GMT
After a few hours poring over these posts, I stumbled across a fix:

If you use just the macroname, the macro will only run if the calling
document is based on the template that contains the menubar (i.e. my
global addin).
  OnAction = "mymacro"

*** To allow the macro to be run from any open document:
  OnAction = "mymodule.mymacro"

If you use the full macro location, it throws a "macro not found"
error:
  OnAction = "myproject.mymodule.mymacro"

Don't ask me why...

> I'm having the same problem as Richard below.
>
[quoted text clipped - 35 lines]
>
> --Richard
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.