E
EBWired
There's a great VBA from pptools.com that I've successfully used for a few
years now (below). Essentially, it'll help toggle text on and off with a
mouse click, and I usually use it for multiple buttons on a single slide
(e.g. for a game). But recently I can't toggle. The first click over the
button will show/hide text, but the second click takes me to the next slide.
And after playing around with keyboard stuff, the code will only work
properly for me if I press tab at the same time I do a left mouse click over
the action button (i.e. it will toggle text correctly rather than go to the
next slide). I never had to press tab before (nor do I want to during
presentations).
Can someone help me troubleshoot? I have PowerPoint 2007 running on Vista.
Thanks.
*****************************
Sub Peekaboo(oSh As Shape)
' Hides/makes visible the shape's text
With oSh.TextFrame.TextRange
' If it has text ...
If Len(.Text) > 0 Then
' Store the text in a tag so we can retrieve it later
oSh.Tags.Add "PeekabooText", .Text
' Now blank the text
.Text = ""
Else
.Text = oSh.Tags("PeekabooText")
End If
End With
End Sub
Sub ResetPeekaboos()
' Resets the shapes with peekaboo text to make the text invisible
Dim oSh As Shape
Dim oSl As Slide
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If Len(oSh.Tags("PeekabooText")) > 0 Then
oSh.TextFrame.TextRange.Text = ""
End If
Next ' oSh
Next ' oSl
End Sub
Sub UnhidePeekaboos()
' Resets the shapes with peekaboo text to make the text visible
Dim oSh As Shape
Dim oSl As Slide
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If Len(oSh.Tags("PeekabooText")) > 0 Then
oSh.TextFrame.TextRange.Text = oSh.Tags("PeekabooText")
End If
Next ' oSh
Next ' oSl
End Sub
Sub HidePeekaboos()
' Resets the shapes with peekaboo text to make the text invisible
' You must have activated the text as peekaboo one time for this to work
Dim oSh As Shape
Dim oSl As Slide
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If Len(oSh.Tags("PeekabooText")) > 0 Then
oSh.TextFrame.TextRange.Text = ""
End If
Next ' oSh
Next ' oSl
End Sub
years now (below). Essentially, it'll help toggle text on and off with a
mouse click, and I usually use it for multiple buttons on a single slide
(e.g. for a game). But recently I can't toggle. The first click over the
button will show/hide text, but the second click takes me to the next slide.
And after playing around with keyboard stuff, the code will only work
properly for me if I press tab at the same time I do a left mouse click over
the action button (i.e. it will toggle text correctly rather than go to the
next slide). I never had to press tab before (nor do I want to during
presentations).
Can someone help me troubleshoot? I have PowerPoint 2007 running on Vista.
Thanks.
*****************************
Sub Peekaboo(oSh As Shape)
' Hides/makes visible the shape's text
With oSh.TextFrame.TextRange
' If it has text ...
If Len(.Text) > 0 Then
' Store the text in a tag so we can retrieve it later
oSh.Tags.Add "PeekabooText", .Text
' Now blank the text
.Text = ""
Else
.Text = oSh.Tags("PeekabooText")
End If
End With
End Sub
Sub ResetPeekaboos()
' Resets the shapes with peekaboo text to make the text invisible
Dim oSh As Shape
Dim oSl As Slide
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If Len(oSh.Tags("PeekabooText")) > 0 Then
oSh.TextFrame.TextRange.Text = ""
End If
Next ' oSh
Next ' oSl
End Sub
Sub UnhidePeekaboos()
' Resets the shapes with peekaboo text to make the text visible
Dim oSh As Shape
Dim oSl As Slide
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If Len(oSh.Tags("PeekabooText")) > 0 Then
oSh.TextFrame.TextRange.Text = oSh.Tags("PeekabooText")
End If
Next ' oSh
Next ' oSl
End Sub
Sub HidePeekaboos()
' Resets the shapes with peekaboo text to make the text invisible
' You must have activated the text as peekaboo one time for this to work
Dim oSh As Shape
Dim oSl As Slide
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If Len(oSh.Tags("PeekabooText")) > 0 Then
oSh.TextFrame.TextRange.Text = ""
End If
Next ' oSh
Next ' oSl
End Sub