in reply to Re: OLE - updating a chart in an excel spreadsheet
in thread OLE - updating a chart in an excel spreadsheet

Every thing up to here works, soon as i put in this bit of code i get the perl interpreter crash hence no error messages.
### Here we update the graphs sourcedata my $Chart1 = $RequestsSheet->ChartObjects("Chart 1"); $Chart1->Activate(); my $name = $Chart1->Name(); print "Chart1 Name: ", $name ,"\n";\ $RequestsSheet->ChartObjects("Chart 1")->Activate(); ############### This line here blows everything up. $Chart1->SetSourceData({Source => '=Data!\$A\$2:\$A\$295'} +);
I have tried to update the Chart1 sourceData this way as well also get the perl interpreter to crash. No error messages.
### Here we update the graphs sourcedata my $Chart1 = $RequestsSheet->ChartObjects("Chart 1"); my $sourceRange = "A1:A295,G1:G295"; my $Chart1Range = $DataSheet->Range($sourceRange); ############### This line here blows everything up. $Chart1->SetSourceData({Source =>$Chart1Range,PlotBy => xl +Columns});

Replies are listed 'Best First'.
Re: Re: Re: OLE - updating a chart in an excel spreadsheet
by jmcnamara (Monsignor) on Mar 18, 2004 at 21:45 UTC

    You don't need to escape the $ in a single quoted string.
    # This line here blows everything up. $Chart1->SetSourceData({Source =>'=Data!\$A\$2:\$A\$295'}

    However, that doesn't fix the problem. The syntax of the second example using the Excel range seems correct but doesn't work. I tried several variations with no success.

    --
    John.

Re^3: OLE - updating a chart in an excel spreadsheet
by Anonymous Monk on Oct 13, 2012 at 00:33 UTC

    This works for me

    my $Chart1Range = $DataSheet->Range("A1:A295,G1:G295"); $Chart1->SetSourceData($Chart1Range,xlColumns);