Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert ActiveX Control Into Powerpoint slide

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!

like image 560
User_FSharp1123 Avatar asked Jun 01 '26 11:06

User_FSharp1123


1 Answers

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.

like image 184
areed1192 Avatar answered Jun 04 '26 12:06

areed1192