I am trying to change the date in the footer for all the files in a specific folder and put in the following macro, but I must have done something wrong because it is not working. Our drive on our server is "W" but I don't know what I have input incorrectly. I saved my macro as "ReplaceDateFooter". Thanks for your help!
Code:
Sub ReplaceDateFooter()
Const D = "W:\PublicWorks\Projects\COF_City_of_Ft_Worth\Specs to play with"
Const Find = "July 1, 2011"
Const Replace = "March 1, 2012"
Dim doc As Document
Dim wd As New Word.Application
Dim fn As String
Dim rng As Range
Dim hf As HeaderFooter
Dim s As Section
fn = Dir(D & "*.doc")
While fn <> ""
Set doc = wd.Documents.Open(D & fn)
Debug.Print fn
For Each s In doc.Sections
For Each hf In s.Footers
Set rng = hf.Range
With rng.Find
.Text = Find
.Replacement.Text = Replace
.Execute Replace:=wdReplaceAll
End With
Next
Next
doc.Save
doc.Close
fn = Dir
Wend
wd.Quit
End Sub