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]
|