Insert Year into a footer

R

Rick B

Hello all,

I have several hundred documents on our LAN with a standard copywrite notice
in the footer. It includes the year and we have to go in every December and
change these to reflect the current year. Can you tell my how to put just
the year in a footer? I can include the date, but not the year. I can
insert a form field into a document and format it as "yyyy" but I can't
place a field in a footer.

My footer looks like...

Revised: 10/21/03 Full Store SI Checklist - Installer.doc Page 1
of 21

Confidential & Proprietary Information of Dealer Computer Services Inc.
and/or Universal Computer Consulting, Ltd. © 2003


Thanks for your help,

Rick B
 
J

Jay Freedman

Hi Rick,

Use the field code

{date \@ "yyyy"}

in the footer of the template to insert the current year. You should be
aware, though, that this field will update when you open the document in
later years -- if you don't want that to happen, you can either unlink it
(Ctrl+Shift+F9) to change it to plain text or lock it (Ctrl+F11) to prevent
it from updating.
 
G

Greg Maxey

Rick,

You might consider a batch file find and replace macro to automate this
process. The following macro will perform a find and replace on all files
in a a common folder. You could search for © 2003 and replace with © 2004:


Public Sub BatchFindReplaceAnywhere()

'Macro by Doug Robbins - 1st March 2004
'with additional input from Peter Hewett to replace text in all the
documents in a folder

Dim FirstLoop As Boolean
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim rngstory As Word.Range
Dim FindText As String
Dim Replacement As String

' Get the folder containing the files
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

'Close any documents that may be open
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

FirstLoop = True

If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If

myFile = Dir$(PathToUse & "*.doc")

While myFile <> ""
'Get the text to be replaced and the replacement
If FirstLoop = True Then
FindText = InputBox("Enter the text that you want to replace.", "Batch
Replace Anywhere")
If FindText = "" Then
MsgBox "Cancelled by User"
Exit Sub
End If
Tryagain:
Replacement = InputBox("Enter the replacement text.", "Batch ReplaceAnywhere
")
If Replacement = "" Then
Response = MsgBox("Do you just want to delete the found text?",
vbYesNoCancel)
If Response = vbNo Then
GoTo Tryagain
ElseIf Response = vbCancel Then
MsgBox "Cancelled by User."
Exit Sub
End If
End If
FirstLoop = False
End If


'Open each file and make the replacement
Set myDoc = Documents.Open(PathToUse & myFile)
' Fix the skipped blank Header/Footer problem
MakeHFValid
' Iterate through all story types in the current document
For Each rngstory In ActiveDocument.StoryRanges
' Iterate through all linked stories
Do
SearchAndReplaceInStory rngstory, FindText, Replacement
' Get next linked story (if any)
Set rngstory = rngstory.NextStoryRange
Loop Until rngstory Is Nothing
Next
'Close the file, saving the changes.
myDoc.Close SaveChanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub
 
Top