Seeking for background informatie

A

Andre Mulder

Hello,

I have created a word template which makes additional menus which will run
several macros, these should be removed after closing the document. When i
create a new document everything works fine, except that when is close the
document i'm asked for a document name and i'm also asked to re-save the
document template.

I have based the code on the 'autonew' and 'autoclose' modules. The macros
used by the menus are created in This.Document. The 'autonew' module creates
the menus, the 'autoclose' module removes the menus.

It could be that i have to auto save the template, or actually ignore the
saving of the template as i don't want the changes (which actually do not
occur) to be written back.

Hope anyone has an idear how to...

Greetings,

André
The Netherlands.
 
J

Jay Freedman

Hi Andre

Unless you're making some kind of dynamic menus that are different for
various uses of the template, you'd be far better off just manually
creating the custom menus *in the template* instead of recreating them
by code each time. Then there would be nothing changing in the
template, and no need to deal with whether or not to save it.

If for some reason you must create the menus in code, then make a
FileSaveAs macro to intercept the SaveAs command, and at the beginning
of it place the line

MyTemplate.Saved = True

where MyTemplate is the Template object that points to the template
containing the code and menus. That's how you lie to Word and say
"this template is clean and doesn't have to be saved". You may need
the same line in a FileSave macro and in the AutoClose macro.
 

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