View Single Post
 
Old 05-01-2017, 09:16 AM
ilcaa72 ilcaa72 is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jan 2014
Posts: 27
ilcaa72 is on a distinguished road
Default Turn off an Initialized Class

hello, i have an this sub that initializes a Class event that runs code on any change of the selection. I wanted to assign a Macro button to "turn off" the event.

Whats the proper VBA to 'de-initialize' the event? thanks

Code:
Sub LoadMonitor()
    Set selMonitor = New Class1
    MsgBox "Selection Change On"
End Sub


'stored in Class Module
Option Explicit
Private WithEvents mWordApp As Word.Application

Private Sub Class_Initialize()
    Set mWordApp = Word.Application
End Sub

Private Sub mWordApp_WindowSelectionChange(ByVal Sel As Selection)
'code here for selection change
Reply With Quote