none
Refresh embedded Excel table Object when Powerpoint open RRS feed

  • Question

  • Hi,

    I am trying to find out any ways that I can code with VSTO to refresh embedded Excel Spreadsheet that has external link to external excel file in Powerpoint

    Below are steps that I did.

    1. Insert Excel Spreadsheet on current PP slide

    2. Copy an Excel Range of data

    3. Paste onto the Powerpoint Excel Spreadsheet object using 'Paste Link (N)'

    4. Update any values on the external Excel file will automatically update the embedded spreadsheet on Powerpoint, all working.

    5. Close the Powerpoint file and exit Powerpoint.

    Here is the issue I have.

    If I update more values on the Excel file and then open the Powerpoint file that contains the embedded Excel spreadsheet object, it DID NOT refresh with update values, unless I manually double-click on the embedded spreadsheet to refresh.

    I thought the embedded object is linked and it should try to update the linking? 

    Is there any ways I can 'force' the embedded excel object to update when Powerpoint file open? 

    I am using Office 2010 and VS 2013.

    Thanks,

    Chris

    Saturday, April 16, 2016 11:34 PM

Answers

  • >>>So my question is, how to update/refresh the embeddedOLEObject upon open the Powerpoint file?

    According to your description, I suggest that you could use Presentation.UpdateLinks method to update linked OLE objects in the specified presentation with PresentationOpen event.

    For more information, click here to refer about Application Events and here to refer about _Presentation.UpdateLinks Method

    In addition could you provide more information about your issue, for example sample code, screenshot etc., that will help us reproduce and resolve it.

    Thanks for your understanding.
    • Marked as answer by David_JunFeng Monday, April 25, 2016 4:10 AM
    Tuesday, April 19, 2016 9:02 AM

All replies

  • >>>I thought the embedded object is linked and it should try to update the linking? 

    Is there any ways I can 'force' the embedded excel object to update when Powerpoint file open?<<<

    According to your description, you could refer to below VBA code then convert them to C#:
    Sub Demo()
    
        Dim osld As Slide
        Dim oshp As Shape
        For Each osld In ActivePresentation.Slides
        For Each oshp In osld.Shapes
        If oshp.Type = msoLinkedOLEObject Then oshp.LinkFormat.Update
        Next oshp
        Next osld
    
    End Sub
    Monday, April 18, 2016 2:10 AM
  • Hi,

    Thanks for your reply. Tried and this won't work as the Shape.Type is not msoLinkedOLEObject. It is actually the 'Microsoft.Office.Core.MsoShapeType.msoEmbeddedOLEObject', which doesn't have the LinkFormat.

    When I put a break point on this line: oshp.LinkFormat.Update, am getting this error:

    "LinkFormat (unknown member) : Invalid request.  This operation requires a linked object."

    So my question is, how to update/refresh the embeddedOLEObject upon open the Powerpoint file?

    Thanks,

    Chris

    Monday, April 18, 2016 8:57 PM
  • >>>So my question is, how to update/refresh the embeddedOLEObject upon open the Powerpoint file?

    According to your description, I suggest that you could use Presentation.UpdateLinks method to update linked OLE objects in the specified presentation with PresentationOpen event.

    For more information, click here to refer about Application Events and here to refer about _Presentation.UpdateLinks Method

    In addition could you provide more information about your issue, for example sample code, screenshot etc., that will help us reproduce and resolve it.

    Thanks for your understanding.
    • Marked as answer by David_JunFeng Monday, April 25, 2016 4:10 AM
    Tuesday, April 19, 2016 9:02 AM