WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Create XL Graph



 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;
 ;Build graphs for results
 ;Trial only
 ;
 ;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


DB              = ObjectOpen("Excel.Application")
DB.Visible      = @TRUE
DB.UserControl  = @TRUE
oAPP            = DB.Workbooks
oAPP.Add()
oWS             = DB.Worksheets(1)
oWS.Activate
oCharts         = DB.Charts

;Define Constants
xlLine = 4
xlColumns = 2
xlLocationAsNewSheet = 1
xlCategory = 1
xlValue = 2
xlPrimary = 1

oWS.Range("A3").Select
DB.ActiveCell.FormulaR1C1 = "Run1"
oWS.Range("A4").Select
DB.ActiveCell.FormulaR1C1 = "Run2"
oWs.Range("A5").Select
DB.ActiveCell.FormulaR1C1 = "Run3"
oWs.Range("A6").Select
DB.ActiveCell.FormulaR1C1 = "Run4"
oWs.Range("A7").Select
DB.ActiveCell.FormulaR1C1 = "Run5"
oWs.Range("A8").Select
DB.ActiveCell.FormulaR1C1 = "Run6"
oWs.Range("A9").Select
DB.ActiveCell.FormulaR1C1 = "Run7"
oWs.Range("A10").Select
DB.ActiveCell.FormulaR1C1 = "Run8"
oWs.Range("B3").Select
DB.ActiveCell.FormulaR1C1 = "2"
oWs.Range("B4").Select
DB.ActiveCell.FormulaR1C1 = "3"
oWs.Range("B5").Select
DB.ActiveCell.FormulaR1C1 = "4"
oWs.Range("B6").Select
DB.ActiveCell.FormulaR1C1 = "5"
oWs.Range("B7").Select
DB.ActiveCell.FormulaR1C1 = "6"
oWs.Range("B8").Select
DB.ActiveCell.FormulaR1C1 = "7"
oWs.Range("B9").Select
DB.ActiveCell.FormulaR1C1 = "8"
oWs.Range("B10").Select
DB.ActiveCell.FormulaR1C1 = "9"
oWs.Range("B3:B10").Select

oCharts.Add()
DB.ActiveChart.ChartType =  xlLine
oSource = DB.Sheets("Sheet1").Range("B3:B10")
DB.ActiveChart.SetSourceData(:: Source=oSource, PlotBy = xlColumns)
DB.ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R3C1:R10C1"
DB.ActiveChart.SeriesCollection(1).Name = "=""Series Name 5.1"""
DB.ActiveChart.Location(:: Where=xlLocationAsNewSheet, Name="save_new_sheet")
DB.ActiveChart.HasTitle = @TRUE
DB.ActiveChart.ChartTitle.Characters.Text = "Transfer rates - chart title"
DB.ActiveChart.Axes(xlCategory, xlPrimary).HasTitle = @TRUE
DB.ActiveChart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Test Identifier - x axis"
DB.ActiveChart.Axes(xlValue, xlPrimary).HasTitle = @TRUE
DB.ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Throughput in MB/sec y axis"


ObjectClose(oCharts)
ObjectClose(oWS)
ObjectClose(oAPP)
ObjectClose(DB)

Article ID:   W17148
File Created: 2007:07:03:14:28:30
Last Updated: 2007:07:03:14:28:30