Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
wrkbook_Open event, Help??
Problems w/ Workbook_Open event
Hi, my events work. Just not the workbook_open, auto_open, or workbook_activate ones that i'm trying t use to accomplish a task. Other events work just fine though...such a workbook_beforeclose() When I open the workbook nothing happens (other than ii openning). put some msgbox commands in the workbook_open() but it doesn't ru them.. Could this be because I have the entire workbook protected (Rea only). Has anyone experienced this or knows what may be causing it? Thank -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
wrkbook_Open event, Help??
Can we see your code? Please also confirm where the code is located i
your project. - Piku -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
wrkbook_Open event, Help??
Sure. I have the events procedure's in the "ThisWorkbook" portion o
the the VBA project. I'd like to mention that the BeforeClose even seems to work fine. Code ------------------- Private Sub Workbook_Open() MsgBox "Workbook opening" ' Application.EnableEvents = False ' Application.StatusBar = "Initializing workbook... Please standby" ' Call Worksheets("Sheet1").refreshFooterSheet1 'refresh footer MsgBox "Workbook opening2" ' Call Worksheets("Sheet1").Sheet1Protection 'redo protection on Unit 1 ' Worksheets("Unit 1").Protect password:="password", userinterfaceonly:=True ' Application.StatusBar = False ' Application.EnableEvents = True End Sub ------------------- As you can see i've commented out most of the procedure calls as I wa afraid they may be causing a problem. I left only the MsgBox to attemp to "see" it. But no dice. ALso, i'm not sure how to test this othe than closing the workbook and opening it again. (if i just run th procedure it works fine, but what I want is it to work when th workbook is open). The entire workbook is protected with the read-only option. Could thi have an effect? I don't think calling the procedures in the Sheet code is a problem (it was an attempt to keep specific code to it respective sheet) since I have a beforeClose event that works and look like: Code ------------------- Private Sub Workbook_BeforeClose(Cancel As Boolean) Call Worksheets("Sheet1").removeSheet1ToolBar Application.EnableEvents = True End Sub ------------------- Thank yo -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
wrkbook_Open event, Help??
The Read Only thing should not affect this. The code works fine for me
but I'm looking at your use of Application.EnableEvents and wondering though it seems to be implemented correctly, if that could be causin your problems. I'd say you should try running just the statemen 'Application.EnableEvents = True' immediately before you reopen th workbook. Try that and let me know what happens... - Piku -- Message posted from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
wrkbook_Open event, Help??
Unfortunately, it still does nothing.
Basically, I have this now: Code ------------------- Private Sub Workbook_Open() Application.EnableEvents = True MsgBox "Workbook opening" End Sub ------------------- Hrm, other things I have the code locked so you need a pw to view it.. The sheet itself isn't protected yet, I will do that after but I doub this has any effect. When I CLOSE the workbook THAT event works fine. Is there an option somewhere to ensure that EnableEvents is True ( mean before this event is 'executed')?? I couldn't find one myself bu i read somewhere it is set to TRue by default... Thank -- Message posted from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
wrkbook_Open event, Help??
It is true by default, but what I'm shooting for is for you to enabl
events from another workbook fefore you open that one. That should b the last thing you do before opening it. - Piku -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA Event | Excel Discussion (Misc queries) | |||
Event Procedures: Event on Worksheet to fire Event on another Worksheet | Excel Programming | |||
Do Event | Excel Programming | |||
change event/after update event?? | Excel Programming | |||
OnTime event not firing in Workbook_Open event procedure | Excel Programming |