in reply to Search and replace in multple MS Word documents
use strict; use warnings; use Win32::OLE::Const 'Microsoft Word'; $Win32::OLE::Warn = 1; my $word = Win32::OLE->new("Word.Application"); $word->{DisplayAlerts} = 0; $word->{Visible} = 0; my $doc = $word->Documents->Open("\\YOUR\\PATH\\TO\\FILE"); my $selection = $doc->Content->Find; $selection->{Text} = "hippopotamus"; $selection->{Replacement}->{Text} = "elephant"; $selection->{MatchCase} = 1; $selection->Execute({Replace => wdReplaceAll}); $doc->SaveAs("\\YOUR\\PATH\\TO\\ALTEREDFILE"); $doc->Close; $word->Quit;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Search and replace in multple MS Word documents
by Wobbel (Acolyte) on Sep 03, 2009 at 07:32 UTC | |
by hominid (Priest) on Sep 03, 2009 at 12:53 UTC | |
by Anonymous Monk on Sep 03, 2009 at 13:01 UTC | |
by Wobbel (Acolyte) on Sep 03, 2009 at 18:33 UTC | |
by Wobbel (Acolyte) on Sep 04, 2009 at 13:39 UTC |