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 / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Depressed toggle button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Drake - 17 Nov 2004 22:59 GMT
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
 
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.