8
votes

I'd like to insert a custom ActiveX control into a Powerpoint slide. I've created the custom control and registered it, and tested that it works. I can easily add the custom control to a UserForm, but can't add it directly to the slide (as per the other controls under Developer Tab -> Controls).

Is it possible to add the custom ActiveX control directly to the slide?

If not, is it possible to embed the UserForm directly to the slide?

Thanks!

1
Did you try to add the control from the Developer --> More Controls --> register custom? - A.S.H
Tried exactly that. I get no errors when I register the control this way, but it is still not available from the "More Controls" menu after registration. - User_FSharp1123
Seems, you have to provide more details about your custom control, for example: what kind of control it is, what tool you used to create it and register it. I'd suggest to read this: Using a VS2008 Custom Control in VBA (NOT VB) and this: Adding Custom Controls to the Control Toolbox - Maciej Los

1 Answers

0
votes

I'm kind of guessing here, but it's worth giving it a shot. When you registered your ActiveX Control, I'm assuming you assigned a Program ID along with it, correct? If you did, then you might be able to add it as a shape object to the slide you specify. When you add a shape, you can add specific types of shapes, including OLEObjects.

For example, in the code below, I add an ActiveX ComboBox Control to Slide 1 in the Active Presentation using PowerPoint VBA. The critical thing to note is that the ProgID identifies the object being inserted.

Sub ActiveXControlAdd()

'Declare your variables.
Dim PPTPres As Presentation
Dim PPTSld As Slide
Dim PPTShp As Shape

'Grab the slide you want it on.
Set PPTPres = ActivePresentation
Set PPTSld = PPTPres.Slides(1)

'Add a shape, but make sure it's an OLEObject. Also, CLASSNAME is the ProgID!
Set PPTShp = PPTSld.Shapes.AddOLEObject(Left:=100, Top:=100, Width:=150, Height:=50, ClassName:="Forms.ComboBox.1")

'Print it out to make sure.
Debug.Print PPTShp.OLEFormat.ProgID

End Sub

Give it a try and see if that maybe fixes the issue.