Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / November 2007

Tip: Looking for answers? Try searching our database.

Looping to control Controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin - 14 Nov 2007 16:33 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:

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
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.