The object hierarchy that OLE uses is odd, but it makes sense once you understand it.
Code has been tested and does work.
#!/Perl/bin/perl
use Win32::OLE
#Make new object
my $excel = Win32::OLE->new('Excel.Application') or die "$!";
#Open the file
$excel->Workbooks->Open("c:\\test.xls") or die "$!";
#Get the chart collection..the Item method returns the nth
#item in the worksheets collection
$charts = $excel->Worksheets->Item(1)->ChartObjects();
#find out how many you have
$chart_count = $charts->{Count};
#loop and chage their left and top properties
#again the item property returns the nth item in the
#charts list
for(my $i=1; $i =< $chart_count; $i++)
{
$charts->Item($i)->{Left}=XXXX;
$charts->Item($i)->{Top}=XXXX
}
|