Question

I have an ActiveX control that installed on my machine, and can be added from PowerPoint via: Developers->Controls->More Controls->"My control". Adding ActiveX control via PowerPoint GUI

I want the user to be able to add the ActiveX via Custom button on the Ribbon.
I successfully added a button to my custom Ribbon (VSTO). but I can't find a way to make this button adding "My Control" to the slide. I also successfully added an Excel sheet by calling:

Shapes.AddOLEObject(1, 1, 100, 100, "Excel.Sheet", "", MsoTriState.msoFalse, "", 0, "", MsoTriState.msoFalse);

but I can't fint the appropriate way to add my custom ActiveX. What am I doing wrong? How can I load this ActiveX from C#?

Was it helpful?

Solution

After two days of searching an answer I found the trick:
the problem is that you need a specific string that recognize the ActiveX control. what I did is:

  1. open Word and on the developers ribbon record a macro (this option not exists in powerpoint) of mouse clicks
  2. add your control (Controls->More Controls->"My control")
  3. stop recording macro.
  4. view the macro's VBA created (click edit macro) you can find a string like "myControlLib.myControlctrl.1"

this is the string needed by the Shapes.AddOLEObject(...) as class name.

OTHER TIPS

Microsoft have a utility called OLE/COM Object viewer. You can use it to find the ProgID (the string used to add ActiveX controls in PowerPoint) along with pretty much everything else you'll want to know about your control. Have a look at:

http://msdn.microsoft.com/en-us/library/d0kh9f4c.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top