in reply to Re: Re: Powerpoint OLE
in thread Powerpoint OLE
So you get an idea of the syntax, I pounded this out this morning over coffee while I caught up on week-end email.
use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft PowerPoint'; $Win32::OLE::Warn = 3; # Die on Errors my $PptApp = Win32::OLE->GetActiveObject('PowerPoint.Application')|| +Win32::OLE->new('PowerPoint.Application', 'Quit'); $PptApp->{Visible} = 1; my $Presentation = $PptApp->Presentations->Add(); #my $Presentation = $PptApp->Presentations->Open({FileName=>'<SOMEFILE +NAME>',ReadOnly=>1}); my $Slide = $Presentation->Slides->Add({Index=>1 , Layout=>ppLayoutTex +t}); $Slide->{Name} = "Slide1"; my $TextBox=$Slide->Shapes->AddTextbox({Orientation=>1, Left=>5, Top=>5, Width=>250, Height=>250,}); $TextBox->TextFrame->TextRange->{Text} ="Big Ole Test"; my $Title=$Slide->Shapes->{Title}; $Title->TextFrame->TextRange->{Text} ="Title Test"; my $NewSlide = $Slide->Duplicate(); $NewSlide->{Name} = "Slide2";
I would suggest that you start PowerPoint and leave it running without any active presentations so that you can watch what is going on. Also, look again at how I call methods that require multiple inputs (Hash format vs. List format), and you need to pay close attention to what certain methods and functions return when called.
C-.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Powerpoint OLE - reading text shapes
by Foggy Bottoms (Monk) on Jun 25, 2003 at 16:15 UTC |