The sense I get from your suggestion is that the Private Sub Workbook Open() routine would not run if I add the suggested code. Is that right?
Yes.
Where would you look it up?
In the VBA Help Files. Type Application. and select EnableEvents from the drop down list. Then press F1 for Help on the property.
Excel Developer Reference
Application.EnableEvents Property
True if events are enabled for the specified object. Read/write Boolean.
Syntax
expression.EnableEvents
expression A variable that represents an Application object.
Example
This example disables events before a file is saved so that the BeforeSave event doesn’t occur.
Visual Basic for Applications
Application.EnableEvents = False prevents ANY events being processed until it is reactivated with Application.EnableEvents = True.
So, for example, if you have a Worksheet Change event and you need to make changes to the worksheet within the Change event handler, you would switch it off before making the changes. This would avoid the event handler looping.
In this case, it would prevent the Workbook Open event from firing when you open each workbook. That, however, may mean that the data is not as up to date as you would like it to be. It will NOT update the data with a web download, etc.
The implication is that the issue is timing related. Some workbooks may not have completed the download and update process before you move onto the next workbook ... is my guess.
Just because code works in stand alone mode in a safe environment and/or when you step through it, it does not necessarily imply it will work "under pressure". Downloads can sometimes be very quick and sometimes be very slow, depending on a number of factors: time of day, volume of data, integrity of the network connection, and so on.
Well, I looked it up in Excel Power Programming with Excel 2013 but I wasn't able to comprehend it all.
As snb says, you shouldn't use (or depend on) code you don't understand.
So, I just tried it and it appears to work so this is indeed progress.
Good
Now if I just knew what I had just done....
I have explained what you have just done and the implications of doing it.
Regards, TMS
Bookmarks