G
Geoff
Hi
I have an addin with a class module which sometimes gives problems after
altering code. I find the class events do not fire until I have stepped
through a procedure in the module. Whenever I change the class code I always
compile and save. But once the events begin to fire there are no further
problems in any scenario.
Can anyone throw some light o what is going wrong and how it may be put right?
T.I.A.
Geoff
In ThisWorkBook module:
Dim oAppEvents As CAppEvents
Private Sub Workbook_Open()
Set oAppEvents = New CAppEvents
End Sub
In CAppEvents class module:
Dim WithEvents oApp As Application
Private Sub Class_Initialize()
Set oApp = Application
End Sub
then various events:
Private Sub oApp_WorkbookOpen(ByVal Wb As Workbook)
Private Sub oApp_WorkbookAddinUninstall(ByVal Wb As Workbook)
Private Sub oApp_WorkbookOpen(ByVal Wb As Workbook)
Private Sub oApp_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As Boolean)
Private Sub oApp_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As
Boolean, Cancel As Boolean)
Private Sub oApp_SheetActivate(ByVal Sh As Object)
Private Sub oApp_WorkbookDeactivate(ByVal Wb As Workbook)
Private Sub oApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
I have an addin with a class module which sometimes gives problems after
altering code. I find the class events do not fire until I have stepped
through a procedure in the module. Whenever I change the class code I always
compile and save. But once the events begin to fire there are no further
problems in any scenario.
Can anyone throw some light o what is going wrong and how it may be put right?
T.I.A.
Geoff
In ThisWorkBook module:
Dim oAppEvents As CAppEvents
Private Sub Workbook_Open()
Set oAppEvents = New CAppEvents
End Sub
In CAppEvents class module:
Dim WithEvents oApp As Application
Private Sub Class_Initialize()
Set oApp = Application
End Sub
then various events:
Private Sub oApp_WorkbookOpen(ByVal Wb As Workbook)
Private Sub oApp_WorkbookAddinUninstall(ByVal Wb As Workbook)
Private Sub oApp_WorkbookOpen(ByVal Wb As Workbook)
Private Sub oApp_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As Boolean)
Private Sub oApp_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As
Boolean, Cancel As Boolean)
Private Sub oApp_SheetActivate(ByVal Sh As Object)
Private Sub oApp_WorkbookDeactivate(ByVal Wb As Workbook)
Private Sub oApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)