![]() |
|
#6
|
||||
|
||||
|
What you are trying to achieve is not possible. Outlook templates do not store macros and while the Outlook editor is Word based it is only superficially like Word. If it was for your own use, you could add a macro to Outlook to enter or change the date in the message body, but you couldn't transport it with the template for other users.
If that will suffice then the following macro in your ThisOutlookSession folder will update and fix the date field (if present) when you click 'Send' for all messages. Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim olInsp As Inspector
Dim wdDoc As Object
Dim orng As Object
Dim ofld As Object
With Item
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set orng = wdDoc.Range
For Each ofld In orng.Fields
If ofld.Type = 31 Then
ofld.Update
ofld.Unlink
End If
Next ofld
.Display
.Save
End With
lbl_Exit
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
| Tags |
| auto update, macro, outlook template |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VBA script to update field codes? | Calab | Word VBA | 1 | 04-07-2014 09:27 PM |
| Auto Update Fields Macro | kveldulv | Outlook | 0 | 06-07-2013 02:30 PM |
Macro to update ole links not working
|
kisa500 | PowerPoint | 7 | 02-05-2013 03:52 AM |
Auto update Filename field
|
Oliver Beirne | Word VBA | 4 | 10-19-2012 03:33 AM |
| Table of Contents - Direct Field Implementation - Auto-Update Numbering | ztag | Word | 3 | 01-19-2012 03:04 PM |