Re: Reference Controls on a Slide

Tech-Archive recommends: Fix windows errors by optimizing your registry



In article <1150731049.946564.248470@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, FireGeek
wrote:
Steve Rindsberg wrote:
In article <1150428518.515527.60710@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, FireGeek
wrote:
I am looking for a way to reference controls on any particular slide in
PowerPoint. For example, I would like to place check boxes on a slide
and depending on which check box is checked, I would like a label to
become visible with text in it. I am planning on having several slides
to function in this manner so I need to know how I can reference these
check boxes on a particular slide.

Simplest thing is to give each shape a name. Then for a shape on, say, slide
12 you can do [aircode]:

Dim oSh as Shape
Set oSh = ActivePresentation.Slides(12).Shapes("MyShapeName")
' and to change its value, assuming it's a checkbox
oSh.OLEFormat.Object.Value = False
' and set its Visible property to false to if you like

To name a shape manually, select it then run:

ActiveWindow.Selection.ShapeRange(1).Name = "whatever you like here"

By giving the shape easily identifiable names (ie, all checkboxes start with
"chk"), you could do something like:

Dim oSl as Slide
Dim oSh as Shape

For Each oSl in ActivePresentation.Slides
For Each oSh in oSl.Shapes
If Left$(oSh.Name,3) = "chk" Then
' it's a checkbox, do your thing
End If
Next
Next

Also, how can I alter the properties of these check boxes at the
beginning of the Power Point slide show? For example, I need to
reference all check boxes and make sure their values are set to false
and the associated labels are invisible.

Any assistance would be greatly appreciated.

Thanks,

Tammy


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

THANKS STEVE for your help. I am still looking to find out how can I
alter the properties of these check boxes at the beginning of the Power
Point slide show? For example, I need to
reference all check boxes and make sure their values are set to false
and the associated labels are invisible.

Any ideas? Anyone?

Tammy


To do *anything* to every shape on each slide, you start with:

Dim oSh as Shape
Dim oSl as Slide

For Each oSl in ActivePresentation.Slides
For Each oSh in oSl.Shapes
' do your stuff here.
If oSh.Type = msoOLEControlObject Then
' you might add an extra check here, like
' If Left$(oSh.Name,5) = "Check" Then ...
.Value = False
.Visible = False
End If
Next
Next
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


.



Relevant Pages

  • Re: vba to find action buttons?
    ... In article, Geoff Cox wrote: ... I have several hundred presentations in which the last slide should ... Dim oSh as Shape ... Steve Rindsberg, PPT MVP ...
    (microsoft.public.powerpoint)
  • Re: Reference Controls on a Slide
    ... I would like to place check boxes on a slide ... Dim oSh as Shape ... Steve Rindsberg, PPT MVP ...
    (microsoft.public.powerpoint)
  • Re: VBA Controls, when value changes boxes not enabled
    ... I think I have the answer - I need to redraw the screen to make it work. ... It lets me mockup screens easily, ... I have a combo box on a slide. ... I want other boxes to appear. ...
    (microsoft.public.powerpoint)
  • Re: Use ActiveX in Powerpoint 2007
    ... I have added in some ActiveX text boxes and combo boxes to allow the ... slide show) and basically reset the slide show so that the next user will have blank ... Dim oSl As Slide ... Steve Rindsberg, PPT MVP ...
    (microsoft.public.powerpoint)
  • Re: Reference Controls on a Slide
    ... I would like to place check boxes on a slide ... Dim oSh as Shape ... ' and to change its value, assuming it's a checkbox ...
    (microsoft.public.powerpoint)