Auto_Open

You should not use the Auto_Open event as this is for backwards compatibility.
If you are opening a workbook using code then the Auto_Open macros will not run automatically.


Excel

In Excel this procedure runs when a workbook is opened.
You should use the Workbook_Open event instead.
This subroutine runs automatically when a workbook (or add-in) is opened manually.
This subroutine must be placed in a standard code module (not a class module, ThisWorkbook, Sheet1 or Userform).
This can be replaced with the Workbook_Open event in 90% of cases.


When you set Application.EnableEvents = False the Auto_Open event still runs.
The scope of Auto_Open does not have to be Public (it can be changed to Private).
Holding down Shift when opening the workbook will disable both Auto_Open and Workbook_Open.
You can call the Auto_Open function manually using Workbook.RunAutoMacros
Workbook_Open is called before Auto_Open if both events exist.


It is not run when a workbook is opened programmatically using the Open method.
If you want the Auto_Open macro to run you need to call it explicitly.

Workbooks.Open 
ActiveWorkbook.RunAutoMacros xlRunAutoMacro.xlAutoOpen

Word (AutoOpen)

In Word this has an equivalent procedure called AutoOpen.
You should use the Document_Open event instead.


Word.wdAutoMacros.wdAutoOpen 

Occurs when you open the document.
If you save this macro in a template it will run every time you attempt to open the template or any document based on that template.
The Document_Open event procedure is equivalent to the AutoOpen event.



PowerPoint

In PowerPoint the Auto_Open is only recognised in add-ins (.ppa) and not in normal presentations (.ppt)
Our productivity add-in can detect if this subroutine has been added to a regular presentation and runs it when it is opened.



© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext