Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Page Layout / July 2004

Tip: Looking for answers? Try searching our database.

Insert Year into a footer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick B - 13 Jul 2004 22:02 GMT
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
Jay Freedman - 13 Jul 2004 22:11 GMT
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.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> Hello all,
>
[quoted text clipped - 16 lines]
>
> Rick B
Greg Maxey - 13 Jul 2004 23:09 GMT
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

Signature

Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in gmaxey@whamspammvps.org

> Hello all,
>
[quoted text clipped - 16 lines]
>
> Rick B
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.