![]() |
|
#3
|
||||
|
||||
|
To do it properly, bookmark the first instance of your date, cross-reference that bookmark for each of the other instances, and use something like the following in the 'This Document' code module of the document or its template:
Code:
Private Sub Document_Open()
If MsgBox("Run Macro?", vbYesNo, "Message") <> vbYes Then Exit Sub
Application.ScreenUpdating = False
Dim BmkRng As Range: Const BmkNm As String = "MyDate"
With ActiveDocument
If .Bookmarks.Exists(BmkNm) Then
Set BmkRng = .Bookmarks(BmkNm).Range
BmkRng.Text = Format(Date + 7, "mmmm d, yyyy")
.Bookmarks.Add BmkNm, BmkRng
End If
.Fields.Update
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| current date, macro, vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
start a macro with command Line startup switches
|
Fesazu | Word | 3 | 02-08-2018 12:15 AM |
| Spell check macro within macro button field doesn't work in one document | samuelle | Word VBA | 0 | 07-20-2016 02:27 AM |
StartUP location
|
ptmuldoon | Word | 2 | 05-12-2015 12:19 PM |
| Save As Macro using first line of document as document name | redzan | Word VBA | 1 | 01-31-2015 09:24 PM |
Merge doc on startup
|
arkay | Mail Merge | 1 | 03-20-2012 11:50 PM |