none
How to open the OLE object in code? RRS feed

  • Question

  • Hi all,

    I add an OLE object (a presentation) on a PowerPoint slide, and create a button on the ribbon menu in order to open this OLE object (in code).

    We can open an OLE object by right clicking on the object and then choose "Slide Object" and "Open".

    Do you know how we do that in code? I am looking around on ole object's properties and on internet, but cannot find out a solution.

    Thanks.
    Monday, May 18, 2015 10:21 AM

Answers

  •  Thanks for your response. I found out that I can achieve that by calling OLEFormat.DoVerb(indexOfVerb). 

     More specific in code:

     
    for (int i = 1; i <= shape.OLEFormat.ObjectVerbs.count; i++)
    {
       string verb = shape.OLEFormat.ObjectVerbs[i];
       if (verb == "Open")
       {
          shape.OLEFormat.DoVerb(i);
          break;
       }
    }
     Thanks

     

    • Marked as answer by chipbk11 Monday, May 18, 2015 1:52 PM
    Monday, May 18, 2015 1:52 PM

All replies

  • VSTO doesn't provide anything for that.

    To find exactly what methods or properties should be called to get the job done I'd recommend recording a macro in Word or Excel. The fact is that a macro recorder is not available in PowerPoint (since 2007). But you can use Excel or Word to record a macro to get a sample code generated. See Create or delete a macro for more information. 

    You may also find the Getting Started with VBA in PowerPoint 2010 article helpful. 

    Monday, May 18, 2015 1:11 PM
  •  Thanks for your response. I found out that I can achieve that by calling OLEFormat.DoVerb(indexOfVerb). 

     More specific in code:

     
    for (int i = 1; i <= shape.OLEFormat.ObjectVerbs.count; i++)
    {
       string verb = shape.OLEFormat.ObjectVerbs[i];
       if (verb == "Open")
       {
          shape.OLEFormat.DoVerb(i);
          break;
       }
    }
     Thanks

     

    • Marked as answer by chipbk11 Monday, May 18, 2015 1:52 PM
    Monday, May 18, 2015 1:52 PM