Article ID: 265113 - View products that this article applies to.
This article was previously published under Q265113
One way to automatically run a macro when you open a workbook is to use the Workbook_Open event in Microsoft Excel. Workbook_Open is a built-in workbook event that runs its macro code each time you manually open the workbook.
The following example uses the Workbook_Open event to run a macro when you open the workbook.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
For additional information about using auto macros and events, click the following article numbers to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/213624/ )How to create an Auto_Open macro to show the Data Form dialog box in Excel 2000
(http://support.microsoft.com/kb/213581/ )XL: Code "behind" worksheet or workbook may not work
(http://support.microsoft.com/kb/213220/EN-US/ )XL2000: Summary of Workbook and Worksheet Application Events
211626For more information about how to use an auto open event, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type workbook object events in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
(http://support.microsoft.com/kb/211626/ )XL2000: EnableEvents property does not work in Automation server