Stuart McLachlan
stuart at lexacorp.com.pg
Wed Jun 29 16:02:09 CDT 2011
Here's how I create a bar chart from PowerBASIC. From VBA would be the essentailly the same thing :) OBJECT CALL oExcelApp.Charts.Add TO oExcelChart vRange = "A1:G2" OBJECT GET oExcelWorkSheet.Range(vRange) TO vSource ' Set the Chart parameters vGallery = %XlChartType.xl3DPie vFormat = 7 vPlotBy = %XlRowCol.xlRows vCatLabels = 1 vSerLabels = 0 vHasLegend = 1 vTitle = "Sales percentages" ' Launch the Chart OBJECT CALL oExcelChart.ChartWizard(vSource, vGallery, vFormat, vPlotBy, vCatLabels, vSerLabels, vHasLegend, vTitle) Note: %XlChartType.xl3DPie and %XlRowCol.xlRows are predefined Numeric Equates -- Stuart On 29 Jun 2011 at 14:42, Brad Marks wrote: > All, > > I have just started to experiment with "Windows Automation" code. > > I have a small Access 2007 application that uses a Record Set to > populate the cells in an Excel spreadsheet and then automatically > create a simple chart (in Excel). This all works nicely. > > Here is the Access VBA code that adds the Chart > > XLSheet.Shapes.AddChart.Select > > I would like to be to control the "Type" of Chart that is generated in > Excel. > > I recorded an Excel Macro while in Excel to see the code that Excel > uses. I then tried to use this code in Access VBA, but did not have > luck. > > Does anyone have an example of how to create an Excel Chart in Access > VBA and be able to control the Chart type? > > Thanks for your help. > > Brad > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >