This will insert text at the beginning of a document.

use strict;
use warnings;
use Win32::OLE;

my $oWord = new Win32::OLE("Word.Application");

my $clBlue = 16711680;
my $clGreen = 32768;

my $oDoc = $oWord->Documents->Add();

$oWord->Selection->TypeParagraph;
$oWord->Selection->Font->{Size} = 14;
$oWord->Selection->Font->{Bold} = 9999998;
$oWord->Selection->Font->{Name} = "Arial";
$oWord->Selection->Font->{Color} = $clGreen;
$oWord->Selection->TypeText("Detailed Reports");
$oWord->Selection->TypeParagraph;

$oWord->Selection->Font->{Size} = 10;
$oWord->Selection->Font->{Bold} = 9999998;
$oWord->Selection->Font->{Name} = "Arial";
$oWord->Selection->Font->{Color} = $clBlue;
$oWord->Selection->TypeText("Detailed Reports2");
$oWord->Selection->TypeParagraph;

$oDoc->SaveAs('c:\my.doc');

$oWord->Quit();




Nathaniel G. Bartusiak
TTMS, Keesler AFB




> Hi Toby
>
> I ran your program on my machine (Win2K pro) with Office 2k.
> Unfortunately both words in the word doc were written in blue and not
> one in green and on in blue as the program suggests they should be.
>
> I think the Range has be moved before the color is changed from green
> to blue. BUT how?
>
> thanks
> Syl
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



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

Reply via email to