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

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});
  • Comment on Re^5: find and replace text in header and footers of MS Office doc and excel
  • Download Code