close

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-gt;Sheets('Charts')-gt;ChartObjects('Chart 1')-gt;Activate();
my $Chart = $Excel-gt;Charts-gt;Open-gt;ChartObjects('Chart 1');
$Chart-gt;ChartArea-gt;Select();
$Chart-gt;SeriesCollection(1)-gt;{Values} = '';
$Chart-gt;{HasTitle} = 1;
$Chart-gt;ChartTitle-gt;Characters-gt;{Text} = '';
$Chart-gt;ApplyDataLabels-gt;{ShowValue};
$Chart-gt;SeriesCollection(1)-gt;Border-gt;{LineStyle} = xlNone;
$Chart-gt;SeriesCollection(1)-gt;Interior-gt;{ColorIndex} = 39;
$Chart-gt;SeriesCollection(1)-gt;DataLabels-gt;Font-gt;{Size} = 8;
$Excel-gt;Sheets('Charts')-gt;ChartObjects('Chart 2)-gt;Activate();
my $Chart = $Excel-gt;Charts-gt;Open-gt;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 quot;my $Chart =
$Excel-gt;Charts-gt;Add;quot; ... 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 quot;hunt and peckquot;
method of testing various values to see if anything works. Any
suggestions for this programming-challenged brain?

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()