Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-27-2015, 07:30 AM
gmayor's Avatar
gmayor gmayor is offline Find & replace footer text in a folder of Word 2010 documents Windows 7 64bit Find & replace footer text in a folder of Word 2010 documents Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default


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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find & replace footer text in a folder of Word 2010 documents Find & Replace in Header/Footer in 1000 files amodiammmuneerk@glenmarkp Word 12 03-05-2018 03:31 AM
Find & replace footer text in a folder of Word 2010 documents 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
Find & replace footer text in a folder of Word 2010 documents How do I find/replace the same word in multiple documents? Ineedhelp! Word 3 03-04-2014 03:50 PM
Find & replace footer text in a folder of Word 2010 documents 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft