OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy |
Reference an ActiveX control on a slide |
|
PowerPoint treats everything inserted on the slide as a shape. If the shape is an ActiveX control, you might want to access & manipulate the properties of the control at run-time thru a macro. This example explains how to get a reference to a text box control placed on the slide. The procedure is similar for other controls too.
This text box draw is an object which is placed on
the slide. Hence to reference the property we would need to get a
reference to this object. Let us see how that is done. One can also get a reference to the object by using the name which
PowerPoint will assign to the shape instead of the Index value.
' -------------------------------------------------------------------------------- Sub GetTextBoxRef() 'Declare an object variable to store the reference Dim otxtBox As TextBox ' MS Forms textbox ' Get a reference to the text box object Set otxtBox = ActivePresentation.Slides(1).Shapes(1).OLEFormat.Object 'Now manipulate it's properties With otxtBox .Text = "We can now control the text box" .SpecialEffect = fmSpecialEffectRaised End With End Sub
Related Link(s): |
|
Let us look at some ways to get a reference to the Title shape. First and foremost it is always prudent to check if the slide has a title shape present or not. This saves us the trouble of looking for something that might not be there. The HasTitle property of the Shapes collection on the slide returns a TRUE if the slide has a title. Thanks to Kedamano for providing the third method '
-------------------------------------------------------------------------------- ' Method 1: Looping thru the
placeholders collection Sub LoopPlaceHolderCollection() ' Method 2: Using the Title
property Sub UseTitleProperty() ' Method 3: Using the
PlaceHolders collection Sub UsePlaceHolders()
|
Copyright 1999-2022 (c) Shyam Pillai. All rights reserved.