Despite my lack of coding experience and using code stolen from various other posts, I have managed to cobble together an Excel VBA that opens up an existing Word document and then customizes it using values in specific cells in my excel workbook. So for example, the VBA searches the Word document for specified phrases like "[Client Name]" and "[Contract Date]" (and so on), and then replaces them with the specified Excel cell values such as "Bob's Burgers, Inc." and "Jan. 9, 2011" (as the case may be). It works great except the "[Client Name]" in each of the Word document's four Headers are completely ignored by the find/replace process.
In short, I am looking for the snippet of code that would modify the existing macro so that it finds/replaces in the headers/footers at the same time as the main body of the document. If this isn't possible, what would the vba code to add an additional find/replace macro to find each instance of "[Client Name]" in each header and replace with the needed custom phrase from Excel?
Here is the find/replace part of my macro as it currently reads:
Set WA = CreateObject("Word.Application")
WA.Documents.Open (pathh)
WA.Visible = True
For oCell = 1 To 44
from_text = Sheets("ReplaceLIST").Range("A" & oCell).Value
to_text = Sheets("ReplaceLIST").Range("B" & oCell).Value
With WA.ActiveDocument
Set myRange = .Content
With myRange.Find
.Execute FindText:=from_text, ReplaceWith:=to_text, Replace:=2
End With
End With
Next oCell