How to enter a macro that performs when a file is closed
Dave,
I'm not sure i understand your point. The Before close event executes only
when a user has decided to close and does nothing to prevent or require that
user to save even if that user has destroyed or messed up the data. The same
risk of lost data would exist with nothing in the before close event or any
macros at all.
Mike
"Dave Peterson" wrote:
I wouldn't hide the sheet when the workbook closes.
After your code hides it, your code will have to save the workbook. If the user
opened the workbook and destroyed 90% of the data and decides to close without
saving, your code just screwed up the workbook.
Instead, I'd hide the worksheet when the workbook opens.
Option Explicit
Sub Auto_Open()
thisworkbook.worksheets("Somesheetname").visible = xlsheethidden
end sub
You could use the workbook_open event if you wanted instead.
Leanne wrote:
I want a sheet to be hiden when the file is closed.
I have done the code to unhide it should the user require but because of
this I want it hiden again when the file is closed (if it has been unhiden)
Can any one tell me where/how I write this?
--
Dave Peterson
|