#1
|
|||
|
|||
Document before save macro?
Is there possible to create a document before save macro in normal dot file?
I mean a "document before safe" macro that works with any document, no need to be in each "ThisDocument" code. Thanks
__________________
Backup your original file before doing any modification. |
#2
|
|||
|
|||
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 |
#3
|
|||
|
|||
Works fine!
Only modified the class module to clsAppMonitor. Thanks!!!
__________________
Backup your original file before doing any modification. Last edited by eduzs; 08-06-2020 at 01:25 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to save Word 2007 document using info from Quick Parts | staicumihai | Word VBA | 2 | 08-08-2018 01:21 AM |
Cant save document as docx or doc using macro in Word 2007 | staicumihai | Word VBA | 1 | 04-27-2018 10:59 AM |
Tweak Macro to Save Each Page of Word Document as Separate PDF or Doc File? | Hewg74 | Word VBA | 3 | 08-22-2016 05:20 PM |
Save As Macro using first line of document as document name | redzan | Word VBA | 1 | 01-31-2015 09:24 PM |
How to save a macro in a document generated with a word model? | Cristin7 | Word VBA | 4 | 03-25-2014 03:25 AM |