Link to home
Start Free TrialLog in
Avatar of Sujatha
Sujatha

asked on

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.
 
ASKER CERTIFIED SOLUTION
Avatar of antrat
antrat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sujatha
Sujatha

ASKER

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
Avatar of Sujatha

ASKER

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.
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
Avatar of Sujatha

ASKER

AutoClose also gets fired only if you base the documents on your template.  I have tried that too.

Sujatha