PDA

View Full Version : Word 2016 Mac DocumentBeforeClose Event



uvg
06-28-2018, 12:09 PM
Hi,

i have a problem with a vba Event Application.DocumentBeforeClose.... thats not fired in this example. Application.DocumentBeforeSave works fine.

Under Windows 10 with Word 2016 works all fine...

Any ideas?

thank you :)

Module1:


Option Explicit
Dim appWord As New AppClass

Sub Register_Event_Handler()
Set appWord.oApp = Word.Application
End Sub


Sub AutoOpen()
MsgBox ("auto open")
Register_Event_Handler
End Sub


AppClass:


Option Explicit
Public WithEvents oApp As Word.Application


Private Sub oApp_DocumentBeforeClose(ByVal doc As Document, Cancel As Boolean)
MsgBox("document before close event")
End Sub

Private Sub oApp_DocumentBeforeSave(ByVal doc As Document, SaveAsUI As Boolean, Cancel As Boolean)
MsgBox("document before save event")
End Sub