Greetings to all,

i want to do some 'find and replace' on a .doc file.
Sample i found on this mailing list was:

-----------------
use strict;
use Win32::OLE;
use Win32::OLE::Const;


my $wd = Win32::OLE::Const->Load("Microsoft Word 9.0 Object Library");
my($outputFile) = 'file.doc';
my($word) = Win32::OLE -> new('Word.Application', 'Quit');
$word -> {Visible} = 1;  # Watch what happens
my($doc) = $word -> Documents -> Open("/perl2exe5.03/wind_spl/ml1.doc"); 
my $search = $doc->Content->Find;
my $replace = $search->Replacement;

$search->{Text} = "searched";
$replace->{Text} = "replace";
$search->Execute({Replace => wdReplaceAll});

$doc -> Close();
$word -> Quit();

-----------------



But it does not work: replacement does not happen.
What is wrong in this code?
Thanks for any answer.

Philippe Paclet

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to