Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

parsing from Excel to Powerpoint

by Foggy Bottoms (Monk)
on Sep 29, 2003 at 20:44 UTC ( [id://295107]=perlquestion: print w/replies, xml ) Need Help??

Foggy Bottoms has asked for the wisdom of the Perl Monks concerning the following question:

I have this list of names in an excel spreadsheet and I'd like to save that list as a series of slides in Powerpoint (2 columns of 140 names would then be 140 slides with 2 names per slide).

I turned to Win32::OLE as I've worked before with it and I can easily read data in the excel sheet. However when it comes to writing in Powerpoint, it fails even though I looked at the VB samples provided in the MSDN. Here's my code, and the error risen
my $pres = $ppt->NewPresentation()->Add("true"); $pres->Slides->Add(1,1); $pres->SaveAs("d:/bizuth.ppt");

and the error is :
Can't call method "Slides" without a package or object reference at D:\readBizuth.pl line 19....

Can someone please help me out ?

Replies are listed 'Best First'.
Re: parsing from Excel to Powerpoint
by Anonymous Monk on Sep 30, 2003 at 08:20 UTC

    Hi,

    The VBA Model for PPT 97 doesn't work that way... it suggests (assuming you Created a PowerPoint.Application object using Win32::OLE ... $ppt->Presentations->Add(1)

    HTH - Mark

Re: parsing from Excel to Powerpoint
by Nkuvu (Priest) on Sep 29, 2003 at 20:48 UTC
    Either the $ppt variable isn't initialized properly (which I doubt, since it didn't complain about the NewPresentation call) or the Add or NewPresentation functions didn't work as you expected. I'd suggest adding a check on the success of the NewPresentation()->Add() call (similar to the way you'd do it for an open).
      If I print $pres, it prints out 1... I've no idea what it means. Shouldn't it return a hash reference ?
        I'd think so. Like you, I've done OLE with MS Excel, but never PowerPoint. But just a plain 1 sounds wrong.

        Edit: Just wanted to add a quick tidbit to mention that I don't have PowerPoint, so I can't do any examination of the OLE behind it. Sorry if this isn't very helpful.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://295107]
Approved by jdtoronto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2024-04-25 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found