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