![]() |
|
|
|
#1
|
||||
|
||||
|
The following macro used as a custom process with should do this. Try it on one of the documents first. The code will not process the footer if the change has already been made. Code:
Function NewFooter(oDoc As Document) As Boolean
Dim oSection As Section
Dim oFooter As HeaderFooter
Dim oRng As Range
Const strFind As String = "A list of employees is open for inspection at our offices."
Const strAddText As String = "ABC Brewery is the trading name of ABC Brewery PLC, registered in England and Wales with company number ABC999." & vbCr
On Error GoTo err_Handler
For Each oSection In oDoc.Sections
For Each oFooter In oSection.Footers
If oFooter.Exists Then
Set oRng = oFooter.Range
If InStr(1, oFooter.Range.Text, strAddText) = 0 Then
With oRng.Find
Do While .Execute(FindText:=strFind)
oRng.InsertBefore strAddText
Exit Do
Loop
End With
End If
End If
Next oFooter
Next oSection
NewFooter = True
lbl_Exit:
Exit Function
err_Handler:
NewFooter = False
Resume lbl_Exit
End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Find & Replace in Header/Footer in 1000 files
|
amodiammmuneerk@glenmarkp | Word | 12 | 03-05-2018 03:31 AM |
Created VBA to Find and Replace in Body, Header and Footer with Highlighting the replacement text
|
QA_Compliance_Advisor | Word VBA | 11 | 09-23-2014 04:40 AM |
How do I find/replace the same word in multiple documents?
|
Ineedhelp! | Word | 3 | 03-04-2014 03:50 PM |
Find & Replace in Header/Footer
|
PReinie | Word | 6 | 01-22-2014 06:45 PM |
| Footer Find & Replace Operation? | binar | Word | 1 | 02-05-2013 10:39 PM |