[AccessD] Working with an Excel Chart from Access (Automation) - How to Create Different Chart Types

Brad Marks BradM at blackforestltd.com
Wed Jun 29 15:33:55 CDT 2011


Rocky,

A few minutes after I posted my question, I stumbled on a solution (I
think).

I am VERY new to the world of Windows Automation, and I thought that
there should be additional parameters on the "Shapes.AddChart" to
control the ChartType.  I then found the ChartType as shown in the third
line below.
This seems to work nicely.  


XLSheet.Shapes.AddChart.Select

Set XLChart = XLSheet.ChartObjects(1).Chart

XLChart.ChartType = xl3DColumnClustered




Thanks for your help. I think that this "Automation Stuff" is sort of
starting to make sense, bit by bit (no pun intended)

Brad

~~~~~~~~~~~~~~~~~~~~~~~~~

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Wednesday, June 29, 2011 3:24 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Working with an Excel Chart from Access
(Automation)-How to Create Different Chart Types

IME, the code I cut from the Excel Macro and paste into Access always
needs
a bit of tweaking.  Can you post the marco code here and maybe someone
will
see the problem.

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
Sent: Wednesday, June 29, 2011 12:43 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Working with an Excel Chart from Access (Automation)
-How
to Create Different Chart Types

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

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





More information about the AccessD mailing list