Question

I'm creating a workbook template for a client that needs to run code as soon as the workbook is opened. The problem is that my Worksheet_Activat event handlers aren't being run.

Code from ThisWorkbook:

Private Sub Workbook_Open()
    Application.EnableEvents = True
    MsgBox "Hello World!"
    ThisWorkbook.Activate
    Sheets("Product").Activate
    Sheets("Raw Data").Activate
End Sub

This code gets run fine, and the MsgBox appears as soon as I create an instance of the template.

Code from the worksheets (They're the same with different strings for the MsgBox):

Private Sub Workseet_Activate()
    MsgBox "RawData"
End Sub

The code will not run when the sheet is activated via code, nor will it run when I manually change worksheets. What would cause the event handler not to handle the event?

Was it helpful?

Solution

You have a misspelling: Workseet_Activate() should be Worksheet_Activate().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top