Compile Error: User-defined Type Not Defined on "Dim AppClass As ExcelEventClass" line in This Workbook code

Engineer Joe

Well-known Member
Joined
Jun 10, 2005
Messages
549
The VBA in this workbook worked flawlessly and then one day I got this compile error upon opening. Code is shown below.
VBA Code:
Option Explicit

Dim AppClass As ExcelEventClass

Private Sub Workbook_AddinInstall()
    
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Call DeleteToolbars
    
    Application.CommandBars("Cell").Reset
    
    On Error Resume Next
        Application.CommandBars(1).Controls("FPT").Delete
    On Error GoTo 0
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If Application.UserName = "Joe Crowe" Then
    
    ThisWorkbook.Sheets("Z Dte").Range("A1").Value = Date + 365

End If

End Sub

Private Sub Workbook_Deactivate()
    
End Sub

Private Sub Workbook_Open()
Dim killdate As Date

Set AppClass = New ExcelEventClass

Call CreateControls

Application.DisplayAlerts = True

Run "Reassignshortcutkeys2"

End Sub

I have referenced Microsoft Excel 16.0 Library in references. Any ideas as to why this would have just popped up recently or more importanly how to fix it?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
It sounds like you lost the reference to whatever library the ExcelEventClass object is part of. Has your IT dept maybe pushed an office update recently?
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top