By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,491 Members | 3,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,491 IT Pros & Developers. It's quick & easy.

Excel Chart Object In Access Report.

P: 1
I've tried numerous times to get Excel to recognise the Excel Chart Object inserted into an Access Report. No Luck.

I can get Access to start an instance of Excel, I can get Access to send the data to Excel. How do I get Excel to now Recognise the Chart object, so I can use Automation to change the features of the chart?
Aug 6 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 634
I've tried numerous times to get Excel to recognise the Excel Chart Object inserted into an Access Report. No Luck.

I can get Access to start an instance of Excel, I can get Access to send the data to Excel. How do I get Excel to now Recognise the Chart object, so I can use Automation to change the features of the chart?
Hi

You could try recording a macro in Excel changing the features you require, and then transfer the code to Access, with the necessary mods, ie. all ojects to be references via the Excel instance in access etc. ?


MTB
Aug 6 '07 #2

FishVal
Expert 2.5K+
P: 2,653
I've tried numerous times to get Excel to recognise the Excel Chart Object inserted into an Access Report. No Luck.

I can get Access to start an instance of Excel, I can get Access to send the data to Excel. How do I get Excel to now Recognise the Chart object, so I can use Automation to change the features of the chart?
Hi.

I suppose you'll not succed this way bkz Access (my somewhat speculative presumption) does not load object to report object frame control.
Expression in report module like Me.OLE1.Object fails with error message smthng like "Object does not exist".
Moreover, if you place OLE object to a form and then place the form to a report within SubForm control, then any attempt to access subform form object will fail.

My very speculative guess is that access supposes that reports should not contain dynamic objects. It calls correspondent object once to generate picture which is rendered to report page.
Aug 6 '07 #3

Expert 100+
P: 634
Hi

Without knowing precisley what you are trying to do but I assume you are coding all this in Access, as you said, using automation. If so then this code returns info from Chart object and resizes it.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdTestChart_Click()
  2.     Dim oExcel As Excel.Application
  3.  
  4.     Set oExcel = CreateObject("Excel.application")
  5.  
  6.     oExcel.Workbooks.Open ("H:\DBForum\Example Database Code etc\TestChart.xls")
  7.  
  8.     Dim chrt As Excel.ChartObject
  9.  
  10.     With oExcel.ActiveSheet
  11.  
  12.         For Each chrt In .ChartObjects
  13.             MsgBox chrt.Name
  14.             .Shapes(chrt.Name).ScaleWidth 1.5, msoFalse, msoScaleFromTopLeft
  15.             .Shapes(chrt.Name).ScaleHeight 1.59, msoFalse, msoScaleFromTopLeft
  16.         Next
  17.     End With
  18.     oExcel.Visible = True
  19. End Sub
HTH

MTB

ps. you also need a reference to the Microsoft Office Object Library
Aug 6 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.