View Single Post
 
Old 05-04-2014, 03:09 AM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,387
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Aside from any issues to do with making the Workbook_BeforeClose macro work correctly, what would probably be a better approach is to intercept the workbook's Save event, via a Workbook_BeforeSave macro. That way, you can:
(a) capture the current visibility state for your worksheet;
(b) hide the worksheet;
(c) save;
(d) restore the pre-save visibility; and, finally
(e) set .Saved = True
That way, you don't need a Workbook_BeforeClose macro, since what's saved will always have the hidden setting (i.e. users will be unable to save the workbook with the sheet visible, even though they may be able to see it).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote