Hi all. I am having a bit of a problem with my Perl script and the
creation of a chart. I can create the chart and create a new
SeriesCollectio n. I then specify the XValues and the Values parameter
of the first SeriesCollectio n object. I add another SeriesCollectio n,
but I am only able to set the XValues and I get the following error
when I try to set the Values parameter:
OLE exception from "Microsoft Office Excel":
Unable to set the Values property of the Series class
Win32::OLE(0.17 01) error 0x80020009: "Exception occurred"
in PROPERTYPUT "Values" at winprocgraph.pl line 101
Here is the snippet of code that is causing me this headache:
#$chart - chart object
#$xls - workbook object
#$worksheet - worksheet object
$chart = $xls->Charts->Add();
$chart->SetSourceData( {Source=>$works heet->Range("A1")} );
$chart->{ChartType} = xlXYScatter;
$chart->SeriesCollecti on->NewSeries();
$chart->SeriesCollecti on->NewSeries();
#this series gets added correctly
$chart->SeriesCollecti on(1)->{XValues} = "='LOGIC'!R2C1: R231C1";
$chart->SeriesCollecti on(1)->{Values} = "='LOGIC'!R2C2: R231C2";
#only the XValues is added correctly here
$chart->SeriesCollecti on(2)->{XValues} = "='LOGIC'!R2C3: R231C3";
$chart->SeriesCollecti on(2)->{Values} = "='LOGIC'!R2C4: R231C4";
$chart->Location({Wher e=>xlLocationAs Object, Name=>"GRAPH"}) ;
Any help would be greatly appreciated. I have been searching online
for examples to try and see what I am doing wrong, and so far it looks
correct to me. Thanks in advance.
Brian
creation of a chart. I can create the chart and create a new
SeriesCollectio n. I then specify the XValues and the Values parameter
of the first SeriesCollectio n object. I add another SeriesCollectio n,
but I am only able to set the XValues and I get the following error
when I try to set the Values parameter:
OLE exception from "Microsoft Office Excel":
Unable to set the Values property of the Series class
Win32::OLE(0.17 01) error 0x80020009: "Exception occurred"
in PROPERTYPUT "Values" at winprocgraph.pl line 101
Here is the snippet of code that is causing me this headache:
#$chart - chart object
#$xls - workbook object
#$worksheet - worksheet object
$chart = $xls->Charts->Add();
$chart->SetSourceData( {Source=>$works heet->Range("A1")} );
$chart->{ChartType} = xlXYScatter;
$chart->SeriesCollecti on->NewSeries();
$chart->SeriesCollecti on->NewSeries();
#this series gets added correctly
$chart->SeriesCollecti on(1)->{XValues} = "='LOGIC'!R2C1: R231C1";
$chart->SeriesCollecti on(1)->{Values} = "='LOGIC'!R2C2: R231C2";
#only the XValues is added correctly here
$chart->SeriesCollecti on(2)->{XValues} = "='LOGIC'!R2C3: R231C3";
$chart->SeriesCollecti on(2)->{Values} = "='LOGIC'!R2C4: R231C4";
$chart->Location({Wher e=>xlLocationAs Object, Name=>"GRAPH"}) ;
Any help would be greatly appreciated. I have been searching online
for examples to try and see what I am doing wrong, and so far it looks
correct to me. Thanks in advance.
Brian
Comment