in reply to Set font size in Words document

Hi sungy,

I am now on a Windows platform and have Microsoft Word available to me.
If you have not yet found a solution to your problem try the following:
#!/usr/bin/perl use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; my $file_name = "c:\\temp.doc"; my $Word = Win32::OLE->new('Word.Application'); $Word->{'Visible'} = 1; my $document = $Word->Documents->Open($file_name) || die("Unable to op +en document", Win32::OLE->LastError()); my $Selection = $Word->Selection; $Selection->WholeStory; $Selection->Font->{'Size'} = '9'; $Word->Documents($file_name)->Save(); $Word->Quit();
Let me know if you have any problems.

Hope this helps.

Martin

Update: Doh!, I should have updated my first post rather than create a second, thats what I get for doing to many things while eating lunch :)

Replies are listed 'Best First'.
Re^2: Set font size in Words document
by sungy (Initiate) on Mar 14, 2006 at 21:20 UTC
    It works, thanks a lot Martin!