I have a text box on certain slides in my presentation (all are named
'VOTextBox') that I want to make visible = true or visible = false based on
user input. Initially I will start by making them all visible = false. I have
the following code in my module, with the expectation that PPT will return an
error if the active slide does not have a control by that name, but the error
trapping doesn't seem to work:
Sub VOTextOff()
Dim x As Long
On Error GoTo NoTextBox
For x = 1 To ActivePresentation.Slides.Count
ActivePresentation.Slides(x).Shapes("VOTextBox").Visible = msoFalse
NoTextBox:
Err.Clear
Next x
End Sub
Help is appreciated.
John Wilson - 14 Nov 2007 17:12 GMT
Are these control text boxes (not normal text boxes)?
If so you will need to use .Shapes("VOTextBox").OLEFormat.Object.visible

Signature
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
> I have a text box on certain slides in my presentation (all are named
> 'VOTextBox') that I want to make visible = true or visible = false based on
[quoted text clipped - 17 lines]
>
> Help is appreciated.
Kevin - 14 Nov 2007 17:15 GMT
Yes, they're ActiveX controls. I tried your solution first but got the same
result.
> Are these control text boxes (not normal text boxes)?
>
[quoted text clipped - 21 lines]
> >
> > Help is appreciated.
David M. Marcovitz - 14 Nov 2007 17:24 GMT
Oh. In that case, combine John's solution and mine,a nd you should get
something that works.
--David

Signature
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
> Yes, they're ActiveX controls. I tried your solution first but got the
> same result.
[quoted text clipped - 32 lines]
>> >
>> > Help is appreciated.
Kevin - 14 Nov 2007 18:59 GMT
David:
I don't understand what you're referring to as your solution.
Thanks
Kevin
> Oh. In that case, combine John's solution and mine,a nd you should get
> something that works.
[quoted text clipped - 36 lines]
> >> >
> >> > Help is appreciated.
David M. Marcovitz - 14 Nov 2007 19:44 GMT
I was referring to my response that said:
Try this instead:
Sub VOTextOff()
Dim x As Long
On Error GoTo NoTextBox
For x = 1 To ActivePresentation.Slides.Count
ActivePresentation.Slides(x).Shapes("VOTextBox").Visible =
msoFalse
Next x
NoTextBox:
Resume Next
End Sub
If you use John's line in place of the ActivePresentation line, it should
work (but I only tested it with my line and regular autoshapes, not
John's line and control shapes).
--David

Signature
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
> David:
>
[quoted text clipped - 44 lines]
>> >> >
>> >> > Help is appreciated.
David M. Marcovitz - 14 Nov 2007 17:23 GMT
Try this instead:
Sub VOTextOff()
Dim x As Long
On Error GoTo NoTextBox
For x = 1 To ActivePresentation.Slides.Count
ActivePresentation.Slides(x).Shapes("VOTextBox").Visible =
msoFalse
Next x
NoTextBox:
Resume Next
End Sub

Signature
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
> I have a text box on certain slides in my presentation (all are named
> 'VOTextBox') that I want to make visible = true or visible = false
[quoted text clipped - 18 lines]
>
> Help is appreciated.
Steve Rindsberg - 14 Nov 2007 22:26 GMT
> I have a text box on certain slides in my presentation (all are named
> 'VOTextBox') that I want to make visible = true or visible = false based on
> user input. Initially I will start by making them all visible = false. I have
> the following code in my module, with the expectation that PPT will return an
> error if the active slide does not have a control by that name, but the error
> trapping doesn't seem to work:
Try this instead:
Sub VOTextOff()
Dim x As Long
On Error GoTo NoTextBox
For x = 1 To ActivePresentation.Slides.Count
ActivePresentation.Slides(x).Shapes("VOTextBox").Visible = msoFalse
Next
NormalExit:
Exit Sub
NoTextBox:
Resume Next
End Sub
OR:
Sub VOTextOff()
Dim x As Long
On Error Resume Next
For x = 1 To ActivePresentation.Slides.Count
ActivePresentation.Slides(x).Shapes("VOTextBox").Visible = msoFalse
Next
End Sub
Also, verify the names of the text box controls.
If you changed the name of the first one then copy/pasted to other slides, they
won't be named VOTextBox necessarily.
> Sub VOTextOff()
> Dim x As Long
[quoted text clipped - 10 lines]
>
> Help is appreciated.
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================