Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: Help using Win32::OLE to add Excel charts having multiple series
by Anonymous Monk on Feb 23, 2010 at 06:34 UTC
    That doesn't look like perl code, or code you have written.
      It is just a Visual basic pseudo code. Please help in writing Win32::OLE perl code to plot the excel chart, that takes the range of a column dynamically
        Um, no. Please ask a clear and coherent actual question, then you can get help in writing, as opposed to someone just writing something for you (and guessing and guessing).