Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Problem with OLE and Powerpoint 2003

by jimbojones (Friar)
on Jul 15, 2005 at 15:17 UTC ( #475246=note: print w/ replies, xml ) Need Help??


in reply to Problem with OLE and Powerpoint 2003

hi

The following worked for me under Office 2003.

use Win32::OLE qw/ in /; my $file = 'C:\Documents and Settings\jim\My Documents\perlmonks_examp +les\sample.ppt'; my $ppt = Win32::OLE->new('PowerPoint.Application', sub {$_[0]->Quit;} +); $ppt->{Visible} = 1; my $presentation = $ppt->Presentations->Open($file); die "Cannot open File '$file': $! " unless ( $presentation ); my $slide = $presentation->slides(1); foreach my $shape ( in $slide->Shapes ) { if ($shape->TextFrame->HasText) { print "Text:", $shape->TextFrame->{TextRange}->{Text} , "\n"; } } __DATA__ Text:This is the sample title Text:This is the sample text.
... where I had a simple, one-slide PPT with a title "This is the sample title" and a text box with "THis is the Sample Text"

The issue may be that the "Shapes" method returns a collection of shapes, and your indexing of it ($slide->shapes($shapeNumber)) may not work under Office 2003. That's only a guess

see also: The MSDN PPT reference docs

- j


Comment on Re: Problem with OLE and Powerpoint 2003
Select or Download Code
Re^2: Problem with OLE and Powerpoint 2003
by Anonymous Monk on Jul 18, 2005 at 08:34 UTC
    This works. Many Thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://475246]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-09-15 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (146 votes), past polls