Converting Macro to Perl - charting help

D

dravon

I have a functioning macro which selects a chartobject, modifies the
various values, and moves to the next chartobject. I'm trying to
convert this macro to perl but am not having any luck. I can get the
perl script to select the chartobject, but from there it can't seem to
associate the modified values with the chartobject which has been
activated. Any suggestions??

$Excel->Sheets('Charts')->ChartObjects('Chart 1')->Activate();
my $Chart = $Excel->Charts->Open->ChartObjects('Chart 1');
$Chart->ChartArea->Select();
$Chart->SeriesCollection(1)->{Values} = '';
$Chart->{HasTitle} = 1;
$Chart->ChartTitle->Characters->{Text} = '';
$Chart->ApplyDataLabels->{ShowValue};
$Chart->SeriesCollection(1)->Border->{LineStyle} = xlNone;
$Chart->SeriesCollection(1)->Interior->{ColorIndex} = 39;
$Chart->SeriesCollection(1)->DataLabels->Font->{Size} = 8;
$Excel->Sheets('Charts')->ChartObjects('Chart 2)->Activate();
my $Chart = $Excel->Charts->Open->ChartObjects('Chart 2');
(etc)

It's that my $Chart line which constantly blows up - all the other
lines work if I'm trying to create a new chart. The line from the
functioning version of this full script is "my $Chart =
$Excel->Charts->Add;" ... but now I want to edit or open or modify an
existing chart object, not add a new chart.

I've tried probably 150 permutations of this one line, but since I'm
not a real perl programmer, I'm just doing this by the "hunt and peck"
method of testing various values to see if anything works. Any
suggestions for this programming-challenged brain?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top