LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Looks for Cell Contents & Performs Action watchtower Excel Programming 1 August 10th 07 02:36 PM
Calling a macro from a closed file Peter[_61_] Excel Programming 5 May 10th 07 05:42 PM
Run macro when file is opened and closed mcphc Excel Programming 2 February 20th 07 11:32 AM
How to create a macro which performs a copy-and-paste task every 5mins after data is refreshed from web page? ­»´ä®a©~¸Ë­× Excel Worksheet Functions 0 December 5th 06 08:57 AM
How to change macro so it performs actions on ACTIVE sheet? Tom9283 Excel Discussion (Misc queries) 6 April 15th 05 07:32 AM


All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"