Reference Controls on a Slide

  • Thread starter Thread starter FireGeek
  • Start date Start date
F

FireGeek

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.

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
 
FireGeek said:
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
 
Steve said:
FireGeek said:
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
 
FireGeek said:
Steve said:
FireGeek said:
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
 
Back
Top