ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto_Open vs. Workbook_beforeopen? (https://www.excelbanter.com/excel-programming/323234-auto_open-vs-workbook_beforeopen.html)

[email protected]

Auto_Open vs. Workbook_beforeopen?
 
All -

I don't understand the differences between Auto_open and
Workbook_beforeOpen, or those for their closing brethern.

Why should one be preferred over the other? Why are there two thigns
that do the same intent?

....best, Hash

Tom Ogilvy

Auto_Open vs. Workbook_beforeopen?
 
Look at Chip Pearson's discussion (summary - one is old, one is new)
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy

wrote in message news:FYwQd.65995$2p.5631@lakeread08...
All -

I don't understand the differences between Auto_open and
Workbook_beforeOpen, or those for their closing brethern.

Why should one be preferred over the other? Why are there two thigns
that do the same intent?

...best, Hash




Oliver Ferns via OfficeKB.com

Auto_Open vs. Workbook_beforeopen?
 
Hi,
Workbook_Open will take precedence over Auto_Open. Auto_Open is only
provided for backward compatibility and will not fire when a workbook is
opened via code. VBA provides a RunAutoMacros method of the workbook which
allows the Workbook_Open event to fire when a workbook is opened via code.
The Workbook _Open event is contained in the ThisWorkbook Class of a
workbook, whereas the Auto_Open macro is contained in a standard Module.
I'm assuming you meant Workbook_Open as opposed to Workbook_BeforeOpen as
AFAIK this event doesn't exist. I don't see how it could. Hope this clears
it up for you.

Cheers,
O

--
Message posted via http://www.officekb.com

Tom Ogilvy

Auto_Open vs. Workbook_beforeopen?
 
Workbook_Open will take precedence over Auto_Open. Auto_Open is only
provided for backward compatibility and will not fire when a workbook is
opened via code


Just to add, Both Workbook_Open and Auto_Open would run if opened manually.

RunAutoMacros is a command you can use to run the Auto_Open macro (or
Auto_Close macro) as part of the same code that opens (or closes) the
workbook. the Workbook_Open macro runs whether the workbook is opened with
code or manually provided Events (an application level setting) are not
disabled.

BeforeClose and Auto_close have a similar relationship.
--
Regards,
Tom Ogilvy

"Oliver Ferns via OfficeKB.com" wrote in message
...
Hi,
Workbook_Open will take precedence over Auto_Open. Auto_Open is only
provided for backward compatibility and will not fire when a workbook is
opened via code. VBA provides a RunAutoMacros method of the workbook which
allows the Workbook_Open event to fire when a workbook is opened via code.
The Workbook _Open event is contained in the ThisWorkbook Class of a
workbook, whereas the Auto_Open macro is contained in a standard Module.
I'm assuming you meant Workbook_Open as opposed to Workbook_BeforeOpen as
AFAIK this event doesn't exist. I don't see how it could. Hope this clears
it up for you.

Cheers,
O

--
Message posted via http://www.officekb.com




[email protected]

Auto_Open vs. Workbook_beforeopen?
 
Oliver -

Thanks. Yes, I got the wrong name. Next version of Excel will
anticipate what spreadsheet we want opened. ;-) It'll be a feature.

It particularly helps about where the code goes.
....best, Hash


In article ,
"Oliver Ferns via OfficeKB.com" wrote:

Hi,
Workbook_Open will take precedence over Auto_Open. Auto_Open is only
provided for backward compatibility and will not fire when a workbook is
opened via code. VBA provides a RunAutoMacros method of the workbook which
allows the Workbook_Open event to fire when a workbook is opened via code.
The Workbook _Open event is contained in the ThisWorkbook Class of a
workbook, whereas the Auto_Open macro is contained in a standard Module.
I'm assuming you meant Workbook_Open as opposed to Workbook_BeforeOpen as
AFAIK this event doesn't exist. I don't see how it could. Hope this clears
it up for you.

Cheers,
O


[email protected]

Auto_Open vs. Workbook_beforeopen?
 
In article ,
"Tom Ogilvy" wrote:

Look at Chip Pearson's discussion (summary - one is old, one is new)
http://www.cpearson.com/excel/events.htm


Tom -

Second round of thanks.

....best, Hash


All times are GMT +1. The time now is 07:53 AM.

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