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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |