Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2018, 06:14 PM
Guessed's Avatar
Guessed Guessed is offline Stamp a document with new Vol#, Issue#, and date Windows 10 Stamp a document with new Vol#, Issue#, and date Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Date stamp in Contact Notes Field nickcwpg Outlook 3 02-20-2019 11:21 AM
Stamp a document with new Vol#, Issue#, and date Date & time stamp problems in Word XP Scotfan Word 3 03-09-2016 09:45 AM
Stamp a document with new Vol#, Issue#, and date Word signatures w/ date stamp TechieHell Word 2 03-16-2015 07:24 AM
Stamp a document with new Vol#, Issue#, and date 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft