Word Minimize/Maximize event capture VBA

Here is a quick little post outlining how to create a minimize/maximize event routine.

Add the following code to a class named EventClassModule

Public WithEvents App As Word.Application

Private Sub App_WindowDeactivate(ByVal Doc As Document, ByVal Wn As Window)
    If Doc.ActiveWindow.WindowState = wdWindowStateMinimize Then
        'you code in here
    End If
End Sub

and then add the following code under ThisDocument

Dim X As New EventClassModule

Private Sub Document_Open()
    'Call Register_Event_Handler
    Set X.App = Word.Application
End Sub

Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *