If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Automatically run a Macro when file opens?
I have one worksheet in a workbook Protected, and I save the file that
way. When I open the file again, the worksheet is no longer protected, although if I select ToolsProtection, my only choice is "UnProtect Worksheet...", so it thinks the worksheet is still protected. Maybe it is, but access to both locked and unlocked cells is allowed. Ok, I don't understand this behavior, and I would like to. When the other person who uses this file opens it, I don't want them using this block of cells. So I figured I could work around it by running an AutoOpen macro, like you can in Word, that would re-Protect that worksheet. Except that a macro entitled "sub AutoOpen()" doesn't work. How do I have a macro run automatically when I open an Excel file? TIA, Andy |
#2
|
|||
|
|||
Automatically run a Macro when file opens?
Use the work book open event, put it in thisworkbook code
Private Sub Workbook_Open() ' Your code here End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 97 ** remove news from my email address to reply by email ** "AA" wrote in message ... I have one worksheet in a workbook Protected, and I save the file that way. When I open the file again, the worksheet is no longer protected, although if I select ToolsProtection, my only choice is "UnProtect Worksheet...", so it thinks the worksheet is still protected. Maybe it is, but access to both locked and unlocked cells is allowed. Ok, I don't understand this behavior, and I would like to. When the other person who uses this file opens it, I don't want them using this block of cells. So I figured I could work around it by running an AutoOpen macro, like you can in Word, that would re-Protect that worksheet. Except that a macro entitled "sub AutoOpen()" doesn't work. How do I have a macro run automatically when I open an Excel file? TIA, Andy |
#3
|
|||
|
|||
Automatically run a Macro when file opens?
I figured out the AutoOpen part.
It's Auto_Open. |
#4
|
|||
|
|||
Automatically run a Macro when file opens?
Use the work book open event, put it in thisworkbook code
Private Sub Workbook_Open() ' Your code here End Sub I used Auto_Open. Does Workbook_Open act differently? |
#5
|
|||
|
|||
Automatically run a Macro when file opens?
Auto_open is a throwback to the old days. It will work but not when you open
with a macro UNLESS you tell it to. Workbook_Open goes in the ThisWorkbook module accessed easily by right click on the excel icon in the upper left next to FILE -- Don Guillett SalesAid Software "AA" wrote in message ... Use the work book open event, put it in thisworkbook code Private Sub Workbook_Open() ' Your code here End Sub I used Auto_Open. Does Workbook_Open act differently? |
#6
|
|||
|
|||
Automatically run a Macro when file opens?
Auto_open is a throwback to the old days. It will work but not when you open
with a macro UNLESS you tell it to. Workbook_Open goes in the ThisWorkbook module accessed easily by right click on the excel icon in the upper left next to FILE Ok, I moved and renamed it. Thanks! |
#7
|
|||
|
|||
Automatically run a Macro when file opens?
glad to help
-- Don Guillett SalesAid Software "AA" wrote in message ... Auto_open is a throwback to the old days. It will work but not when you open with a macro UNLESS you tell it to. Workbook_Open goes in the ThisWorkbook module accessed easily by right click on the excel icon in the upper left next to FILE Ok, I moved and renamed it. Thanks! |
Thread Tools | |
Display Modes | |
|
|