WorkbookActivate Event

Microsoft Excel Visual Basic

WorkbookActivate Event

       

Occurs when any workbook is activated.

Private Sub app_WorkbookActivate(ByVal Wb As Workbook)

app   An object of type Application declared with events in a class module. For more information, see Using Events with the Application Object.

Wb   The activated workbook.

Example

This example arranges open windows when a workbook is activated.

Private Sub App_WorkbookActivate(ByVal Wb As Workbook)
    Application.Windows.Arrange xlArrangeStyleTiled
End Sub