![]() |
Application State on file Open
Hi all, I'm using Excel under MS Vista (I think that's Excel 2007?)
and I want to set certain things when a file opens and closes like sheet protections, hidden tabs, passwords. I've seen it done where a series of macros are run as soon as the file opens or closes. Can anyone tell me if there is a specific module name or sub name that triggers a macro to run automatically on file open or close? or, more generally, how do I get a macro to run automatically in these cases? Many thanks! |
Application State on file Open
In your wb do an Alt+F11 to get into the VBE;
Once in there - do a Control+R - hold-down the control key and press the R key - that will put you into the Project Explorer Window - Look for the "Thisworkbook" node. Double-Click it and it puts you into the Code Window you will see two drop-down boxes at the top of this window. On the left one - you should see "General" - click the drop-down then you should see Workbook << click on it !! When you do an Event-handler will fill the screen -- it's name Workbook_Open... Put your code between these two lines,, save and close the workbook. THen Open Again Good Luck !! " wrote: Hi all, I'm using Excel under MS Vista (I think that's Excel 2007?) and I want to set certain things when a file opens and closes like sheet protections, hidden tabs, passwords. I've seen it done where a series of macros are run as soon as the file opens or closes. Can anyone tell me if there is a specific module name or sub name that triggers a macro to run automatically on file open or close? or, more generally, how do I get a macro to run automatically in these cases? Many thanks! |
All times are GMT +1. The time now is 07:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com