Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Workbook Open event does not fire

There have been many threads discussing the problem that sometimes,
mysteriously, the workbook open event does not fire, despite
EnableEvents = True.

I have encountered this frustrating problem myself on numerous
occasions and have concluded it is an Excel bug which, even in the
latest version, has not been resolved.

I rememeber reading an MSDN article (but cannot now find) recommending
using the old Auto_Open subroutine. Sometimes this works, sometimes
it doesn't.

I have wasted countless hours trying to isolate the problem.
Sometimes it appears to be resolved and then it's back again! Aaah!
Actually if you have other workbooks open, the problem can propogate
to them as well. As soon as you close the offending workbook, all is
back to normal!

I can't guarantee that the following will work in all circumstances
but when I struck the problem again recently, I seemed to resolve it
by setting the workbook to manual calculation (via the menu, not VBA).
To overcome the irritation of having to constantly press F9, I added
this event procedure in the Workbook module:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Excel.Range)
Application.Calculate
End Sub

I'd be interested in feedback whether this works for others. The
solution suggests that VBA sometimes gets confused when opening a
workbook and trying to recalculate at the same time.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Workbook Open event does not fire

I've never experienced the problem, but I've seen posts that do this kind of
thing:

Private Sub Workbook_Open()
Application.OnTime Now, "Continue_Open"
End Sub

Then in a General module,

sub Continue_Open()
'your real code here
end sub

I guess the thought is to let excel do some housekeeping and get caught up.

And if you're opening that workbook with the workbook_open code via a macro and
that macro is called from a shortcut key---And that shortcut key includes the
Shift key, then this can cause trouble.

When you hold down the shift key while you're opening a workbook (manually),
then excel doesn't run the auto_open or workbook_open code.

And the shiftkey in the shortcut key can confuse excel so that it doesn't run
the code.

Maybe sometimes you'd run the code to open the problem workbook via
Tools|macro|macros... and sometimes through a shortcut key???



Robots wrote:

There have been many threads discussing the problem that sometimes,
mysteriously, the workbook open event does not fire, despite
EnableEvents = True.

I have encountered this frustrating problem myself on numerous
occasions and have concluded it is an Excel bug which, even in the
latest version, has not been resolved.

I rememeber reading an MSDN article (but cannot now find) recommending
using the old Auto_Open subroutine. Sometimes this works, sometimes
it doesn't.

I have wasted countless hours trying to isolate the problem.
Sometimes it appears to be resolved and then it's back again! Aaah!
Actually if you have other workbooks open, the problem can propogate
to them as well. As soon as you close the offending workbook, all is
back to normal!

I can't guarantee that the following will work in all circumstances
but when I struck the problem again recently, I seemed to resolve it
by setting the workbook to manual calculation (via the menu, not VBA).
To overcome the irritation of having to constantly press F9, I added
this event procedure in the Workbook module:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Excel.Range)
Application.Calculate
End Sub

I'd be interested in feedback whether this works for others. The
solution suggests that VBA sometimes gets confused when opening a
workbook and trying to recalculate at the same time.


--

Dave Peterson
Reply
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
Event doesn't fire Frank Xia Excel Discussion (Misc queries) 6 February 11th 06 12:54 AM
Workbook Open Event does not fire Jon Somerset Excel Programming 1 October 15th 04 12:49 PM
Event class doesn't fire in embedded VBA Tornados[_5_] Excel Programming 0 September 28th 04 03:27 PM
Date/Time Picker Event Won't Fire Mark Driscol Excel Programming 1 July 14th 04 03:28 PM
Event to fire when pivottable is pivoted Tod Excel Programming 1 April 5th 04 09:09 PM


All times are GMT +1. The time now is 03:15 AM.

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"