in reply to Re^2: 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

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

  • Comment on Re^3: find and replace text in header and footers of MS Office doc and excel

Replies are listed 'Best First'.
Re^4: find and replace text in header and footers of MS Office doc and excel
by marto (Cardinal) on Oct 11, 2016 at 15:24 UTC
Re^4: find and replace text in header and footers of MS Office doc and excel
by Corion (Patriarch) on Oct 11, 2016 at 15:19 UTC

    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});