Attached template save prompt

L

Laurent

Hi

I'm lost.

I read most posts here and quite a number of Web pages about the Attached
template Save prompt behavior, but I can't figure out.

I have this nice template with Word XP that contains shortcuts, macro,
toolbars and nifty menus. I saved it under Application
data/Microsoft/Word/startup. Some toolbar and menus macros have a Down/Up
status button macros.

New or existing documents are NOT based on this template. It is just
attached to Word for extended fonctionnality.

Whenever I use some of the macros, it changed something in the template
(up/down icon status I guess), and when I try to exit Word, I am always
prompted to save the template. Obviously, I don't want to, under any case.


I tried to add this in the template

Private Sub Document_Close()
ActiveDocument.Saved = True
End Sub

but it did't work.

I tried many variations as well, such as

Sub Document_Close()
ThisDocument.Saved = True
End Sub

OR

Sub Document_Close()
ActiveDocument.AttachedTemplate.Saved = True
End Sub

OR

Sub AutoClose()
ActiveDocument.Saved = True
End Sub


etc.

but I can't get it.

Any help appreciated.
 
L

Laurent

in
microsoft.public.word.vba.general

Solved myslef the problem after one full day (I'm a newbie)!


It was indeed the Up and Down subroutines that were modifying the Save
state of the template each time they were called. Therefore I added a line
in both sub to change the Save state back to True.

Sub Up()
Dim myButton As CommandBarButton

Set myButton = CommandBars.ActionControl
myButton.State = msoButtonUp
ThisDocument.Saved = True ;This is what I needed.
End Sub
 

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