Posts Tagged ‘Word’

Word Minimize/Maximize event capture VBA

Friday, January 30th, 2009

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

Related posts:

  1. Generic file selection window function in VBA
  2. VBA automatically saves Excel 2003 Workbook in compatibility mode as Excel 2007 Workbook
  3. Rigid file manipulation functions for VBA/VBS