Range("C1:C721").Select
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("Data").Range("A1:C721"),
+ PlotBy:= _
xlColumns
ActiveChart.SeriesCollection(1).XValues = "=Data!R2C1:R721C2"
ActiveChart.Location Where:=xlLocationAsNewSheet
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = False
ActiveChart.Axes(xlCategory).Select
With Selection.Border
.Weight = xlHairline
.LineStyle = xlAutomatic
End With
With Selection
.MajorTickMark = xlNone
.MinorTickMark = xlNone
.TickLabelPosition = xlNextToAxis
End With
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
And it converted to this code:$sheet->Range("C1:C721")->Select;
my $chart = $workbook->Charts->Add;
$chart->{Name} = "Chart";
$chart->{ChartType} = xlLine;
$chart->SeriesCollection(1)->{XValues} = "=Data!R2C1:R721C2";
$chart->Location(xlLocationAsNewSheet);
$chart = $excel->ActiveChart;
$chart->{HasLegend} = "False;
$chart->Axes(xlCategory)->{MajorTickMark} = xlNone;
$chart->Axes(xlCategory)->{TickLabels}{Font}{Size} = 5;
See my home node for a picture of the chart and data, if you like. Ooh! and if anyone's looking for a meaty project, how about a script to automatically convert an Excel macro into perl? That's be nice! ;-) |