ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   D'you know: Workbook_Open is not called first(!) (https://www.excelbanter.com/excel-programming/433790-dyou-know-workbook_open-not-called-first.html)

joeu2004

D'you know: Workbook_Open is not called first(!)
 
Did you know that Workbook_Open is __not__ called first when a workbook is
opened?

Of course, the macro security check occurs first. That's expected.

But then all formulas with volatile functions (UDFs as well as internal
functions like RAND and NOW) are calculated first as well as any dependent
cells, if the calculation mode is Automatic.

I'm probably the only the VB programmer for whom this comes as a surprise.
I'm learning by experimentation. But I thought I'd pass along the
observation, just in case it is news to one other person ;-).

I cannot think of too many consequences of this "disorder". I 'spose it
could matter to someone who wants to record the time (and date) when the
workbook is opened. That time will be incorrect if there is a significant
amount of volatile calculation (like many minutes worth).

Then again, the only application that I can think of where that might be the
case is a simulation model. But in that case, I would expect the
calculation mode is Manual.


Patrick Molloy[_2_]

D'you know: Workbook_Open is not called first(!)
 
the workbook's OPEN event will fire first, then if there is one, an Auto_Open
sub will run



"JoeU2004" wrote:

Did you know that Workbook_Open is __not__ called first when a workbook is
opened?

Of course, the macro security check occurs first. That's expected.

But then all formulas with volatile functions (UDFs as well as internal
functions like RAND and NOW) are calculated first as well as any dependent
cells, if the calculation mode is Automatic.

I'm probably the only the VB programmer for whom this comes as a surprise.
I'm learning by experimentation. But I thought I'd pass along the
observation, just in case it is news to one other person ;-).

I cannot think of too many consequences of this "disorder". I 'spose it
could matter to someone who wants to record the time (and date) when the
workbook is opened. That time will be incorrect if there is a significant
amount of volatile calculation (like many minutes worth).

Then again, the only application that I can think of where that might be the
case is a simulation model. But in that case, I would expect the
calculation mode is Manual.




All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com