ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Converting Macro to Perl - charting help (https://www.excelbanter.com/charts-charting-excel/87174-converting-macro-perl-charting-help.html)

dravon

Converting Macro to Perl - charting help
 
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?



All times are GMT +1. The time now is 03:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com