My Assistant
![]() ![]() |
|
|
Mar 9 2004, 01:34 AM
Post
#1
|
|
|
New Member Posts: 17 |
I have a chart in a report, and I would like to be able to change its type (say from line to bar) using visual basic, but i can't figure out how?
Any suggestions? Thanks, Justin |
|
|
|
Mar 9 2004, 03:18 AM
Post
#2
|
|
|
UtterAccess Addict Posts: 135 From: Chennai, India |
Hello for the same type of my problem KingMartin has given the solution for me .That solution is as follows
CODE Sub ChangeChartType()
Dim Sht As Worksheet Dim Cht As ChartObject For Each Sht In ThisWorkbook.Worksheets For Each Cht In Sht.ChartObjects Cht.Chart.ChartType = xlLine ' you can change any chart type here instead of X1Line Next Cht Next Sht End Sub -------------------------------------------------------------------------------- I hope you can adapt this to your requirements Thanks To kingMartin thanks to you (IMG:http://www.utteraccess.com/forum/style_emoticons/default/thanks.gif) Edited by: cs51 on 03.09.04. |
|
|
|
Mar 9 2004, 07:35 AM
Post
#3
|
|
|
New Member Posts: 17 |
No luck yet.
When I run: Debug.Print Me.ReportChart.Object.Application.Chart.ChartType I get the following error: 2771 - The bound or unbound object frame you tries to edit doesn't contain an OLE Object Does it matter that the chart is in a report? Thanks, Justin |
|
|
|
Mar 10 2004, 05:11 AM
Post
#4
|
|
|
UtterAccess Addict Posts: 135 From: Chennai, India |
Sorry this works fine in Excel charts
As the chart is in report it may not be working you can give reference to excel object by using Tools > references in VBE (alt+F11) and click checkmark against Microsoft Excel 9.0 Object library and try the above code Thanks |
|
|
|
Mar 10 2004, 10:58 PM
Post
#5
|
|
|
UtterAccess Addict Posts: 135 From: Chennai, India |
Hello one more suggestion
Instead of pasting chart in your report using unbound frame object(after browsing for the file which contains the chart) , you can check a mark against Link When you are linking to the source whatever you change in source it will be reflected in your report also.In this way I hope you can solve your problem Thanks cs (IMG:http://www.utteraccess.com/forum/style_emoticons/default/thanks.gif) |
|
|
|
Mar 23 2004, 01:33 PM
Post
#6
|
|
|
New Member Posts: 2 |
I'm getting the same error on a form with an ActiveX control (Spin Button). When the filtered form returns 0 records, it returns that error. I "solved' it by setting AllowAdditions = True.
Not the same problem as yours but the quirks in Access work in mysterious ways. Hope it might help. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th May 2013 - 08:23 AM |