Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: Workbook_Activate Event Does Not Fire When Driven Programmatically


View products that this article applies to.

This article was previously published under Q294810

↑ Back to the top


Symptoms

When you close a workbook programmatically, the Workbook_Activate event is not triggered for the next open workbook that Excel activates.

↑ Back to the top


Cause

Workbook and worksheet events are not designed to run when Excel is being controlled programmatically.

↑ Back to the top


Resolution

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. To work around this behavior, call the Workbook_Activate event from the code that closes the active workbook, for example:
Sub Launch_workbook_event()

   ' The (1) is the index number for the first opened workbook.
   ' You can use the specific workbook name instead.

   Workbook(1).Activate

   ThisWorkbook.Close

End Sub
				

↑ Back to the top


Keywords: KB294810, kbinfo

↑ Back to the top

Article Info
Article ID : 294810
Revision : 7
Created on : 10/10/2006
Published on : 10/10/2006
Exists online : False
Views : 217