Consulting

Results 1 to 4 of 4

Thread: "Object is not connected to server" when editing chart data

  1. #1
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location

    "Object is not connected to server" when editing chart data

    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:
    [vba]
    Dim oChartObject As Object
    Dim shapeType As Integer

    With oShape
    shapeType = .Type
    If shapeType = 7 Then ' Chart
    Set oChartObject = .OLEFormat.Object
    [/vba]
    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?

  2. #2
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location
    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.

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    Obvious question: Have you restarted the computer lately?

    Also, which OS and PP versions?

    Paul

  4. #4
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location
    Quote Originally Posted by Paul_Hossler
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •