Hey everyone -
okay, except for the fact that the button needs therapy....
I need help with a custom button - I want it to show as depressed when it is
True. Here is my current code. What should I add and where?
Thanks!
--------
Public Sub Show_Hide()
If ActiveDocument.ActiveWindow.View.ShowHiddenText = True Then
ActiveDocument.ActiveWindow.View.ShowHiddenText = False
ElseIf ActiveDocument.ActiveWindow.View.ShowHiddenText = False Then
ActiveDocument.ActiveWindow.View.ShowHiddenText = True
ActiveDocument.ActiveWindow.View.ShowAll = False
End If
End Sub
Klaus Linke - 17 Nov 2004 23:26 GMT
> okay, except for the fact that the button needs therapy....
Hi Drake,
Here's what the doctor orders:
Dim myCBB As CommandBarButton
Set myCBB = CommandBars.ActionControl
With ActiveDocument.ActiveWindow.View
.ShowHiddenText = Not(.ShowHiddenText)
myCBB.State = Not (myCBB.State)
.ShowAll = False
End with
Regards,
Klaus
Klaus Linke - 17 Nov 2004 23:33 GMT
On second thought, you don't really know which state you're starting with
(hidden text displayed, or not).
So you better keep your original "If ...", and set "myCBB.State =
msoButtonDown"/"myCBB.State = msoButtonUp" as desired.
Klaus
Drake - 18 Nov 2004 18:45 GMT
Perfect Klaus! Thanks!
> On second thought, you don't really know which state you're starting with
> (hidden text displayed, or not).
> So you better keep your original "If ...", and set "myCBB.State =
> msoButtonDown"/"myCBB.State = msoButtonUp" as desired.
>
> Klaus
Jezebel - 18 Nov 2004 11:47 GMT
First, you can replace all of this
> If ActiveDocument.ActiveWindow.View.ShowHiddenText = True Then
> ActiveDocument.ActiveWindow.View.ShowHiddenText = False
> ElseIf ActiveDocument.ActiveWindow.View.ShowHiddenText = False Then
> ActiveDocument.ActiveWindow.View.ShowHiddenText = True
with...
With ActiveDocument.ActiveWindow.View
.ShowHiddenText = not .ShowHiddenText
end with
What you haven't explained is where this button is located... on a toolbar?
on a form? on a UserForm?
> Hey everyone -
>
[quoted text clipped - 14 lines]
> End If
> End Sub
Drake - 18 Nov 2004 16:53 GMT
Hi Jezebel -
the button is on a toolbar. Sorry - thought I had said that.
> First, you can replace all of this
>
[quoted text clipped - 31 lines]
> > End If
> > End Sub