Convert MS Chart to GIF

  • Thread starter Thread starter Ananth Godavari
  • Start date Start date
A

Ananth Godavari

Hello Every one,

I have written a some code that will export a MS Chart
object (on a report or a form) to a gif image using
the "Export" command of chart object.

This is creating a new process graph.exe (can be found in
task manager) each time the chart is converted and is not
released upon closing of the report that contains the
chart.

Further, Access shuts down with the critical error, "The
operation on the chart object failed. The ole server may
not be registered, to register the ole server, reinstall
it." when the form or report that contains the chart is
closed.

The report closes without any error if the Graph.Exe
process is ended fromt the task manager.

Any ideas of how I can overcome this issue? I tried to
explicitly make it "Nothing" but did not work.

Thanks
Ananth
 
Hi Ananth Godavari,

From your descriptions, I understand that after you try to programmatically
export a Microsoft Graph object, you will receive the following error
message: The ole server may not be registered. Have I understood you? If
there is anything I misunderstood, please feel free to let me know.

Based on my knowledge, It may be an known issue for us and I found an KB
described this issue, which provide an workaround. You could find that KB
at:

Access Quits Unexpectedly When You Programmatically Export a Graph Object
http://support.microsoft.com/?id=824276

I am so sorry for the inconvenience you have meet and hope this helps. If
you have any questions or concerns, don't hesitate to let me know.

Sincerely yours,

Michael Cheng
Microsoft Online Support
***********************************************************
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks.
 
Michael,

Thank you for posting the details. I have implemented the
workaround as described in the KB article, but does not
seem to be working either.

I get an error "Microsoft Office Access can't perform the
operation specified in the Action property of the Visual
Basic procedure you're trying to run." at the line Reports
(rpt).Controls(chrt).Action = acOLEClose

Here is the function that I wrote.

Public Sub ConvertChart(rpt As String, chrt As String, fl
As String)
On Error GoTo Err_Proc

DoCmd.OpenReport rpt, acViewPreview
Dim grpApp As Graph.Chart
Set grpApp = Reports(rpt).Controls(chrt).Object

grpApp.Export fl, "GIF", True
Set grpApp = Nothing

Reports(rpt).Controls(chrt).Action = acOLEClose
MsgBox "Chart Successfully converted", vbInformation

Exit_Proc:
Err.Clear
Exit Sub

Err_Proc:
MsgBox "Following error Occured in converting" +
vbCrLf + Trim(Err.Number) + Err.Description, vbCritical
Resume Exit_Proc

End Sub

Any input on this is highly appreciated.

Thanks
Ananth
 
Hi Ananth,

Based on my testing , I could reproduce your issue with the same error
message.

I make a Chart to Form and Reports from Insert -> Chart and then use the
same codes as you provided. I could make it export without any difficulty
in Form, but failed and got the same error message like you when try to
export Chart in Reports.

However, I am sorry to say that you could not use Chart in Reports because
Chart in Reports will lost some properties, including Action Property.
That's why we will get that error message.

Moreover, I recommand you select another Object to use instead of Chart and
I feel sorry for the inconvenience that you may meet.

Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!

Sincerely yours,

Michael Cheng
Microsoft Online Support
***********************************************************
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks.
 
Back
Top