![]() |
|
|
|
#1
|
||||
|
||||
|
I would be using a content control linked to a built-in document property for the Number, and a SaveDate field for the date.
To add the content control, put your cursor in the header and type in "No. " and then go to Insert > Quick Parts > Document Property > Category. To add the SaveDate field, put your cursor in the header and go to Insert > Quick Parts > Field > SaveDate (and chose the relevant Date Format), click OK The final part is to add a macro which can update the Category property and save the file to adjust the date. Code:
Option Explicit
Sub IncrementNumber()
Dim i As Integer
i = Val(ActiveDocument.BuiltInDocumentProperties("Category").Value) + 1
ActiveDocument.BuiltInDocumentProperties("Category").Value = i
ActiveDocument.Save
UpdateAllFields
End Sub
Sub UpdateAllFields()
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date stamp in Contact Notes Field | nickcwpg | Outlook | 3 | 02-20-2019 11:21 AM |
Date & time stamp problems in Word XP
|
Scotfan | Word | 3 | 03-09-2016 09:45 AM |
Word signatures w/ date stamp
|
TechieHell | Word | 2 | 03-16-2015 07:24 AM |
Issue with date format in mail merge document
|
walshjod | Mail Merge | 4 | 11-28-2012 04:46 AM |
| Outlook 2003-formatting vba Date stamp | Royzer | Outlook | 0 | 03-29-2012 10:39 AM |