Query on adding a custom menu in MS Word

R

Remittag

Greetings!

We wish to put forward a query regarding adding a custom menu in MS Word as
follows:-

Background

We are developing a software application using Visual Basic 6.0 (for the
Front-End GUI) and MS Access (as back-end database) that allows a user to
build, store, and organize a databank of MS Word documents. In the interface
of the application which allows a user to enter data, there is a section
where we have embedded an OLE (Object Linking and Embedding) container
control. The user has to double click this section, wherein an instance of MS
Word (if installed) is opened up. The user can now enter and save anything in
this Word document.

Query - Adding a Custom menu in MS Word

What we want to achieve is that while the user is working on a document in
MS Word, he should be able to send this document to our application without
actually opening our application. A possible solution according to us, is to
add a custom menu in MS Word titled something like "Export to MyOrganiser".
Clicking this menu will copy the document to the Data folder of our
application, and thus an entry will be created in our database.

Suggested solution 1 - Using the Macro feature in MS Word

Currently, we have implemented the above solution using the macro feature
available in MS Word. By using the macro feature, we have modified the MS
Word Normal Template to add the menu. This is working properly in case of MS
Word 97 version i.e a new document created, shows our custom menu. But, in
case of MS Word 2003 version, the new document created, does not show our
custom menu.

We wish to know whether it is right to modify the MS Word Normal template to
implement the above solution? If yes, then will this approach work with all
future versions of MS Word?

Suggested solution 2 - Creating an Add-in

Else, another possible solution according to us, is to create an Add-in. In
this case, we would request you to kindly suggest the procedure for the same.
It would be helpful if you provide some sample source code or examples.

Also, kindly inform if there is any other solution to add a custom menu,
besides the above ones suggested by us.

We look forward to your reply at the earliest.
 
J

Jay Freedman

We wish to know whether it is right to modify the MS Word Normal
template to implement the above solution?

No, this is not the correct solution. Normal.dot is supposed to be a
scratchpad for individual users to save their own customizations. It is poor
practice for other programs to alter it. For one thing, unless special care
is taken, the user will be prompted each time Word is shut down to allow
saving of changes to Normal.dot -- and since the user didn't make the
changes, he or she won't know what caused the prompt. This is discussed in
http://word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm with respect to
macros, and the same considerations apply for custsom menus and toolbars.
Else, another possible solution according to us, is to create an
Add-in.

This is correct, as discussed in the same article. An add-in (in this sense)
is only a template (.dot file) stored in the Startup folder indicated in
Tools > Options > File Locations. By default this path is C:\Documents and
Settings\<username>\Application Data\Microsoft\Word\STARTUP. Although the
user could choose another folder, most users never change this.

You don't need any code in the add-in to supply a custom menu. Just build
the menu in the template (using either VBA code that you need to run only
once, or the Tools > Customize dialog as in
http://word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToToolbar.htm), save
the template, and distribute it.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top