You should not use the Auto_Close event as this is for backwards compatibility.


In Excel this procedure runs just before a workbook is closed
You should use the WorkbookBeforeClose event instead.
The WorkbookBeforeClose event procedure is equivalent to the Auto_Close subroutine.
This event will not run if the workbook is closed using code (??)

ActiveWorkbook.RunAutoMacros xlRunAutoMacro.xlAutoClose 

Word (AutoClose)

In Word this has an equivalent procedure called AutoClose.
Occurs when you close 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.
You should use the DocumentBeforeClose event instead.
The DocumentBeforeClose event procedure is equivalent to the AutoClose subroutine.


In PowerPoint the Auto_Close subroutine is only recognised in add-ins (.ppa) and not in normal presentations (.ppt)
An add-in can detect if this subroutine has been added to a regular presentation and run it when it is opened.
You should use the PresentationBeforeClose event instead.
The PresentationBeforeClose event procedure is equivalent to the Auto_Close subroutine.

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