use Diagnostics; use strict; use Win32::GUI; use Win32; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Word'; use Win32::OLE::Const 'Microsoft PowerPoint'; my $wordApp = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application', sub {$_[0]->Quit;}) or die "NO WORD!" ; $wordApp->{Visible} = 1; my $wordDoc = $wordApp->Documents->Add("/work/CG.dot"); # Go to the insertion point my $point = $wordDoc->GoTo({What => wdGoToBookmark, Name => "Start"}); my $ins_range = $point->Duplicate; #insert in default font $ins_range->InsertAfter("Hello"); $ins_range->InsertParagraphAfter(); # $ins_range->Font->Name = "Arial" gives illegal lvalue $ins_range->Font->Name("Courier New"); $ins_range->InsertAfter("GoodBye"); #Also, this fails with type mismatch in my real proggie # but not when I take it as an example; my $dst = "foo.doc"; $wordApp->ActiveDocument->SaveAs({ FileName => $dst, FileFormat => wdFormatDocument });