Find and replace in footers?

4 views
Skip to first unread message

alice

unread,
Sep 27, 2001, 11:29:45 AM9/27/01
to
I am using Excel 2000. I've been looking around for a way
that I can programmatically find a text string in a footer
and replace it with a different string. Is this possible?

J.E. McGimpsey

unread,
Sep 27, 2001, 12:02:06 PM9/27/01
to
Try this:

Public Sub FooterReplace(findWhat As String, replaceWhat As String)
With ActiveSheet.PageSetup
.LeftFooter = Application.Substitute( _
.LeftFooter, findWhat, replaceWhat)
.CenterFooter = Application.Substitute( _
.CenterFooter, findWhat, replaceWhat)
.RightFooter = Application.Substitute( _
.RightFooter, findWhat, replaceWhat)
End With
End Sub


In article <400001c14769$3c9f5e20$9ae62ecf@tkmsftngxa02>,
"alice" <orie...@yahoo.com> wrote:

--
J.E. McGimpsey ar...@zptvzcfrl.pbz
ROT13 encoding, decode for real mail

David McRitchie

unread,
Sep 27, 2001, 1:52:27 PM9/27/01
to
Hi Alice,
If you want to adapt J.E McGimpsey's code to process all sheets
in a workbook. You could use a macro such as:

Sub AllSheetsFooterReplace()
Dim s As Worksheet
Application.ScreenUpdating = False
For Each s In ActiveWorkbook.Worksheets
'Invoke J.E. McGimpsey's code with following line....
FooterReplace("fromthis", "tothat")
Next s
Application.ScreenUpdating = True
End Sub

If this has anything to do with pathname you might want to take a look
at http://www.geocities.com/davemcritchie/excel/pathname.htm
The code above was untested but adapted from some code on that page.

HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Macros: http://www.geocities.com/davemcritchie/excel/excel.htm
Search Page: http://www.geocities.com/davemcritchie/excel/search.htm

"J.E. McGimpsey" wrote...

alice

unread,
Sep 27, 2001, 2:47:56 PM9/27/01
to
Thanks guys. That did the trick.
Alice

>.
>

Reply all
Reply to author
Forward
0 new messages