XL2000: Workbook_Activate Event Does Not Fire When Driven Programmatically (294810)



The information in this article applies to:

  • Microsoft Excel 2000

This article was previously published under Q294810

SYMPTOMS

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

CAUSE

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

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
				

Modification Type:MinorLast Reviewed:10/10/2006
Keywords:kbinfo KB294810