Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Making a chart in Excel
; //////////////////////////////////////////////////////// ; Excel OLE Example for Creating Charts ; NOTE: run script with parameter for Pie Chart ; Stan Littlefield - September 25, 2002 ; //////////////////////////////////////////////////////// DB = ObjectOpen("Excel.Application") DB.Visible = @TRUE DB.UserControl = @TRUE oAPP = DB.Workbooks oAPP.Add() oWS = DB.Worksheets(1) oWS.Activate If IsDefined( param1 ) Then Goto pie :column oCell = oWS.Cells( 1, 1 ) oCell.Value = "A" oCell = oWS.Cells( 2, 1 ) oCell.Value = "B" oCell = oWS.Cells( 3, 1 ) oCell.Value = "C" oCell = oWS.Cells( 1, 2 ) oCell.Value = 1 oCell = oWS.Cells( 2, 2 ) oCell.Value = 2 oCell = oWS.Cells( 3, 2 ) oCell.Value = 3 oCell = oWS.Cells( 1, 3 ) oCell.Value = 4 oCell = oWS.Cells( 2, 3 ) oCell.Value = .5 oCell = oWS.Cells( 3, 3 ) oCell.Value = 2 oCell = oWS.Cells( 1, 4 ) oCell.Value = 3 oCell = oWS.Cells( 2, 4 ) oCell.Value = 4 oCell = oWS.Cells( 3, 4 ) oCell.Value = 1 oCell = oWS.Range("A1:D3") oFont = oCell.Font oFont.Name = "Tahoma" oFont.Size = 12 oFont.Bold = @TRUE oCell.Select() oCharts = DB.Charts oCharts.Add() oChart = DB.Charts(1) oChart.Activate oChart.HasTitle = @TRUE oTitle = oChart.ChartTitle oTitle.Text = "Sample for Column Chart" Goto end :pie oCell = oWS.Cells( 1, 1 ) oCell.Value = "A" oCell = oWS.Cells( 2, 1 ) oCell.Value = .5 oCell = oWS.Cells( 1, 2 ) oCell.Value = "B" oCell = oWS.Cells( 2, 2 ) oCell.Value = 53.5 oCell = oWS.Cells( 1, 3 ) oCell.Value = "C" oCell = oWS.Cells( 2, 3 ) oCell.Value = 28.7 oCell = oWS.Cells( 1, 4 ) oCell.Value = "D" oCell = oWS.Cells( 2, 4 ) oCell.Value = 10 oCell = oWS.Cells( 1, 5 ) oCell.Value = "E" oCell = oWS.Cells( 2, 5 ) oCell.Value = 6.3 oCell = oWS.Range("A1:E2") oFont = oCell.Font oFont.Name = "Tahoma" oFont.Size = 12 oFont.Bold = @TRUE oCell.Select() oCharts = DB.Charts oCharts.Add() oChart = DB.Charts(1) oChart.ChartType = 5 oChart.Activate oChart.HasTitle = @TRUE oTitle = oChart.ChartTitle oTitle.Text = "Sample for Pie Chart" :end ObjectClose(oChart) ObjectClose(oCharts) ObjectClose(oWS) ObjectClose(oAPP) ObjectClose(DB) Exit
Article ID: W15636
File Created: 2003:05:13:11:29:20
Last Updated: 2003:05:13:11:29:20