Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Alerts for Save

Status
Not open for further replies.

Andrea001

Technical User
Jan 21, 2002
29
US
I've set DisplayAlerts to False before I close the current workbook because I don't want to be prompted to save. However I'm worried about the macro closing before it has a chance to reset the DisplayAlerts to True. Is this an issue I need to address or does Excel automatically set the DisplayAlerts to true when opening a new file?
Thanks,
Andrea
 
Andrea,

Here is what I have discovered by testing the DisplayAlerts property, at least in Excel 97:

1) Although the Help entry says DisplayAlerts will not automatically be re-set to True after a macro ends (as was the case for earlier versions), it was.

2) Setting DisplayAlerts = False did not prevent Excel from prompting to save changes.

Based on this, I would answer that there is no issue with the macro terminating before DisplayAlerts can be re-set. To prevent Excel from prompting to save changes, use
Code:
ThisWorkbook.Saved = True
inside the
Code:
Workbook_BeforeClose
event procedure.

Hope this helps.
M. Smith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top