in reply to Re: find and replace text in header and footers of MS Office doc and excel
in thread find and replace text in header and footers of MS Office doc and excel

I'll give it a shot - thank you
  • Comment on Re^2: find and replace text in header and footers of MS Office doc and excel

Replies are listed 'Best First'.
Re^3: find and replace text in header and footers of MS Office doc and excel
by Anonymous Monk on Oct 11, 2016 at 15:17 UTC

    So these are all Visual basic solutions. I was hoping to see Perl code. I am not familiar with Visual Basic. - Thanks

      Did you know that you can easily convert Visual Basic to Perl by basically replacing every Foo.Bar in the VB code with $Foo->Bar in the Perl code?

        Didn't know that - thanks again

        Without using Format/Style, the text in the body of the Word doc is being replaced, but footnotes are not. So, I am being specific to the footnote. Is there something wrong with this code?

        $selection = $word->ActiveDocument->Content; $selection->Find->ClearFormatting; $selection->Find->{Style} = $word->ActiveDocument->Styles("Footnote Te +xt"); $selection->Find->Replacement->ClearFormatting; $selection->Find->Replacement->{Style} = $word->ActiveDocument->Styles +("Footnote Text"); $selection->Find->{Text} = "Software"; $selection->Find->Replacement->{Text} = "SW"; $selection->Find->{Wrap} = wdFindContinue; $selection->Find->{Format} = 'True'; $selection->Find->{MatchCase} = 'False'; $selection->Find->{MatchWholeWord} = 'False'; $selection->Find->{MatchWildcards} = 'False'; $selection->Find->{MatchSoundsLike} = 'False'; $selection->Find->{MatchAllWordForms} = 'False'; $search_res = $selection->Find->Execute({Replace => wdReplaceAll});