Hi All,

I'm trying to write a basic perl script to open a Word document, change some 
predefined values to something else.

It works fine on a basic document, but anything with text boxes it doesn't work 
at all.

The script I run is:

use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';

my $word = Win32::OLE->new('Word.Application');
$word->{visible} = 1;
my $doc = $word->{Documents}->Open("C:\\Word\\Certificate.doc");

my $search =  $doc->Content->Find;
my $replace = $search->Replacement;
$search->{Wrap} = wdFindContinue;
$search->{Text} = "#tPreferredName#";
$replace->{Text} = "Chris";
$search->Execute({Replace => wdReplaceAll});

$doc->SaveAs("C:\\Word\\Certificate_changed.doc");

If you would like a ZIP file of the documents and PL file to show this problem, 
please ask and I will send them off list.

Any help would be appreciated, I'm new at this!

Cheers,

Chris

----------------------------------------------
Chris Cox
B.IT.(Information Systems) 
Senior Software Engineer

Creatop Interactive Media
Level 1, 240 McCullough Street
Sunnybank. Qld. 4109
Australia
Ph:      1300 85 80 85
Int'l Ph:     +61 7 3216 9755
Mobile: +61 412 416600
http://www.creatop.com.au/
[EMAIL PROTECTED]
---------------------------------------------- 
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to