Thanks for the help, guys. I have finally sussed it!

I recorded this macro while creating the chart:

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! ;-)

In reply to Re^4: Excel macro to perl conversion. by spikey_wan
in thread Excel macro to perl conversion. by spikey_wan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.