I am writing a program that uses Win32::OLE to plot an Excel chart of type xlXYScatterSmoothNoMarkers having multiple new series. For example, First series data should be from column A and B. And Second series data should be from Column C and Column D My problem is i am not able to get the source data dynamically. i.e Column A and B data can extend depending on the data. Examples in Using Win32::OLE and Excel were invaluable. Please help.

Sample Data.xls file ======================= A B C D 1 10 1 30 2 12 2 40 3 13 3 50 4 14 4 60 5 15 5 20 6 16 6 10 7 17 8 18
Tried below Visual basic code, but not able to translate the same co +de to perl Range("A1").Select Range(Selection, Selection.End(xlDown)).Select data = Selection.Address(RowAbsolute:=False, ColumnAbsolute:=False +) myRange = data & "," Range("C2").Select Range(Selection, Selection.End(xlDown)).Select GraphXSeries = Selection.Address(RowAbsolute:=False, ColumnAbsolut +e:=False) Range("D2").Select Range(Selection, Selection.End(xlDown)).Select GraphValue = Selection.Address(RowAbsolute:=False, ColumnAbsolute: +=False) Range("C1").Select GraphName = Selection.Address(RowAbsolute:=False, ColumnAbsolute:= +False) With SampleGraph .ChartType = xlXYScatterSmoothNoMarkers .SetSourceData Source:=Sheets(WorksheetName).Range(myRange), _ PlotBy:=xlColumns .Location Where:=xlLocationAsObject, Name:=WorksheetName ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(2).Name = Worksheets(WorksheetNam +e).Range(GraphName) ActiveChart.SeriesCollection(2).XValues = _ Worksheets(WorksheetName).Range(GraphXSeries) ActiveChart.SeriesCollection(2).Values = _ Worksheets(WorksheetName).Range(GraphValue) End With

In reply to Help using Win32::OLE to add Excel charts having multiple series by Anonymous Monk

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.