Thread: [Solved] Document before save macro?
View Single Post
 
Old 08-06-2020, 08:21 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,427
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

You could set up a Application Event Monitor as a class in your Normal Template.


Add a new class module. Call it csAppMonitor and paste in the following code:
:
Code:
Option Explicit
Public WithEvents oAddInMontiorApp As Word.Application

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

Private Sub oAddInMontiorApp_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean)
  MsgBox "Beep"
End Sub

In a standard module of your Normal.dtom, Declare:
Public oMonitor As clsAppMonitor



Then in the AutoExec sub
Set oMonitor = New clsAppMonitor
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote