Posted on 2006-12-22 09:26:24-08 by jonalmond in response to 2756
Re: MORE XL CHARTS
After much hair-tearing I got the Range assignment to work by using LetProperty instead of the hash syntax.
Win32::OLE->Option(Warn => 2); use Win32::OLE::Const 'Microsoft.Excel'; $sel = $ole->selection; $sheet = $ole->ActiveSheet; $thischart = $ole->ActiveWorkbook->Charts->add; $thischart->{ChartType} = xlColumnClustered; $rngXValues = $sheet->Range($sheet->Cells(2,2),$sheet->Cells(14,2)); $rngValues = $sheet->Range($sheet->Cells(2,3),$sheet->Cells(14,3)); if ($thischart->SeriesCollection->{Count} == 0) { $thisSeries = $thischart->SeriesCollection->NewSeries; } else { $thisSeries = $thischart->SeriesCollection(1); } $thisSeries->LetProperty('Values',$rngValues); $thisSeries->LetProperty('XValues',$rngXValues); $ole->{Visible} = 1;
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.