Application State on file Open

J

joyt.williams

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!
 
G

Guest

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top