Thread: [Solved] Document before save macro?
View Single Post
 
Old 08-06-2020, 08:21 AM
gmaxey gmaxey is online now Windows 10 Office 2016
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,108
gmaxey has a spectacular aura aboutgmaxey has a spectacular aura aboutgmaxey has a spectacular aura about
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