Win32::OLE adding shape to OLE Object (xlsheet) in PPT

Discussion in 'Perl Misc' started by Lance Hoffmeyer, Nov 17, 2003.

  1. I am trying to add a shape to an Excel table of numbers within Powerpoint.

    Here is the code I am using. I do not get an error but I do not
    get the shape either?

    Lance


    use strict;
    use warnings;
    use Win32::OLE;
    use Win32::OLE qw(in with);
    use Win32::OLE::Const 'Microsoft PowerPoint';
    use Win32::OLE::Const 'Microsoft Excel';
    use Win32::OLE::Const 'Microsoft Office';
    use Win32::OLE::Variant;
    use Time::localtime;
    ###############################################################################
    ##############################################################################
    ## DEFINE SOME PATHS
    ####
    ###############################################################################
    ###############################################################################
    my $dirpath = "C:\\test"; # Path to Excel and PPT

    my $ppt=Win32::OLE->GetActiveObject('Powerpoint.Application')||
    Win32::OLE->new('PowerPoint.Application','Quit');
    $ppt->{Visible} = 1;
    my $p2 =
    $ppt->Presentations->Open({FileName=>"$dirpath"."\\Mainreport.ppt"});
    foreach my $z (in $p2->Slides(4)->Shapes())
    {
    if ($z->{Type}== 7){
    my $zz=$z->OLEFormat->Object;
    my $wsheet = $zz->Worksheets(1)->Shapes->AddShape(msoShapeOval, 10, 10,
    30, 30);
    }
    }
     
    Lance Hoffmeyer, Nov 17, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VP
    Replies:
    1
    Views:
    2,327
    Oliver
    Nov 1, 2003
  2. Lance Hoffmeyer

    win32com ppt embedded object

    Lance Hoffmeyer, Jul 10, 2007, in forum: Python
    Replies:
    2
    Views:
    676
    Lance Hoffmeyer
    Jul 11, 2007
  3. Lance Hoffmeyer
    Replies:
    2
    Views:
    539
    Lance Hoffmeyer
    Jul 26, 2007
  4. Charles Fox
    Replies:
    1
    Views:
    607
    Chris
    Dec 10, 2007
  5. Johnny Google
    Replies:
    4
    Views:
    152
    Ala Qumsieh
    Nov 11, 2004
Loading...

Share This Page