PDA

View Full Version : "Object is not connected to server" when editing chart data



Cosmo
10-22-2010, 08:07 AM
I've started getting an error in an update of a program I have been using for a while, I'm trying to get data from a cell in a chart, but I am getting an error

"Automation error
Object is not connected to server (-2147220995)"

The line where this is happening is in a function which retrieves a specific piece of data from the presentation. The relevant portion is below:

Dim oChartObject As Object
Dim shapeType As Integer

With oShape
shapeType = .Type
If shapeType = 7 Then ' Chart
Set oChartObject = .OLEFormat.Object

The error occurs on the last line where i am setting oChartObject to the OLEFormat.Object for the chart.

The program successfully pulls the data from 2 other cells in the same chart, but throws an error when it gets to this cell. Previous versions seem to work properly, and the same code will pull data from an older version of the PPT file with data.

Does anyone know what could be causing this error, and what I can do to remedy this?

Cosmo
10-22-2010, 09:23 AM
Actually, it looks like I'm getting 2 errors, intermittantly,


Method 'Object' of object 'OLEFormat' failed (-2147220995)
occurs on the line stated above, and

Automation error
Object is not connected to server (-2147220995)"
occurs when trying to access the Title of the chart.

Paul_Hossler
10-23-2010, 02:20 PM
Obvious question: Have you restarted the computer lately?

Also, which OS and PP versions?

Paul

Cosmo
10-25-2010, 06:50 AM
Obvious question: Have you restarted the computer lately?

Also, which OS and PP versions?

Paul
Hmm, don't remember if I had restarted or not on Friday, I'll do a restart when I get a chance today. I'm running the program in PPT 2007 on Windows XP.

I found that the error I was getting which would prevent the OLEObject from reading the data did not occur consistently. I put the code which read the values from the chart into a loop, and exited the loop if the OLEObject was read properly or if the loop executed 10 times. In all of my testing, it never took more than a second try to access the OLEObject.

So, for now it looks like I have a band-aid which works properly, and when I get a chance, I'll need to look into the situation better to see why the error is happening in the first place.