View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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