Microsoft Word - Close button

Word 97/Word 2000
I have developed a document template. It is a global template that is put in the Startup folder. I use the document template just to store my menu items. The documents that I open will not be based on this template. Depending upon the menu item clicked upon, I enable/disable some menu items.  Now when I close Word I get the message "Changes have been made to the global template xxxx.dot. Would you like to save your changes?". I do not wish this message to appear, instead I want the changes that I have done to be discarded. Is there a way that this could be achieved?
Note:
1)As the documents that would be opened will not be based upon my template, handling the Close event or the AutoClose event did not help.
2)I do not want to save my menu items in the Normal.dot either as sometimes i get the message "Normal.dot was being edited by another session..."
3)Also saving the changes explicitly by doing a template.Save lead to problems in the case of multiple instances of Word.
 
SujathaAsked:
Who is Participating?
 
antratConnect With a Mentor Commented:
Hi sujatha

Put this bit of code in "ThisDocument" of your global template. It will trick word into thinking it has been saved.

Private Sub documentclose()
Application.Documents.Save = True
End Sub

antrat

0
 
SujathaAuthor Commented:
Hi Antrat,
   Thank you for your quick response. I did put the piece of code that you had sent me in the ThisDocument of my template. But, as I had already made a mention in my note, as the Word documents are not based on my global template, the Document_Open event does not get fired at all.

Sujatha
0
 
SujathaAuthor Commented:
The event that I had used was Document_Close.  But have wrongly stated as Document_Open in my comment. As mentioned in my comment my problem still persists.
0
 
antratCommented:
Sorry about that I did not realise. Anyway it seems that procedures placed in "ThisWorkbook" do not have global scope.
But Auto Macros do, so if you place the macro below in a normal module for your template it should work.

Sub AutoClose()
Application.Documents.Save = True
End Sub

antrat
0
 
SujathaAuthor Commented:
AutoClose also gets fired only if you base the documents on your template.  I have tried that too.

Sujatha
0
All Courses

From novice to tech pro — start learning today.