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

L

Lance Hoffmeyer

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);
}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top