Exporting Graphs out of Access!!

Johnnyw

Registered User.
Local time
Today, 22:43
Joined
Feb 19, 2001
Messages
13
I have a report that has a Graph on it. It is a Microsoft Graph element. I can't seem to get the entire graph and report to export to any format. Only what is on the report itself excluding the graph gets exported. Another thing, when I view a graph, in print preview and I open it up in design view, the numbers are not always the same. Microsoft Graph seems to use whats on the datasheet instead of whats in the query. Can someone please help me understand the screwy Microsoft Graph.
 
johnnyw,

First of all, i must say that i tend to avoid using Charts in Access Reports like the plague that they are... so i cannot help you with the details of using them.

however, a long while back a friend asked me a similar question when she wanted to export a chart from an access report (she had managed to get a chart working in the report). After some research i wrote some code like the example below, and it exports the chart as an image file.

For this to work you will need to set a Reference to the Microsoft Graph Object Library so you can access the object model for charts in your VBA code.
__________________________________________

Dim cht as Graph.Chart

'--report must be physically open for this to work
DoCmd.OpenReport "MyReport", acViewPreview, acEdit

DoEvents

Set cht = Reports("MyReport").Controls("MyChart")
'--export as gif. you can specify other formats like BMP or JPEG as well
cht.Export "c:\temp\MyGraph.gif", "GIF"
Set cht = Nothing

DoCmd.Close acReport, "MyReport"
__________________________________________

You need to run this code as part of a function or sub

Hope that helps some.

axa



[This message has been edited by axa (edited 08-28-2001).]
 

Users who are viewing this thread

Back
Top Bottom