Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Button from Control Box

I have a button created from the ControlBox that has in its Caption
properties HIDE.
The Hide Button looks very rich (dark and bold) as is (When I open the
Workbook).
It is working Ok based on the code below.
Only problem is when I click it (Hide) it hides columns DFJ and L and
changes to UNHIDE, but the UNHIDE box now looks anemic, the borders
especially (with the grayed-out look).. What am I missing to have it look
comparable to my HIDE button look?


Private Sub ToggleButton1_Click()
With Range("D:D,F:F,J:J,L:L")
If ToggleButton1.Value = True Then
.EntireColumn.Hidden = True
ToggleButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
ToggleButton1.Caption = "Hide"
End If
End With
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Button from Control Box

That is how it makes it looked depressed. If you don't want that effect,
use a commandbutton.

--
Regards,
Tom Ogilvy


"JMay" wrote in message news:QJMZb.8209$iB.4889@lakeread06...
I have a button created from the ControlBox that has in its Caption
properties HIDE.
The Hide Button looks very rich (dark and bold) as is (When I open the
Workbook).
It is working Ok based on the code below.
Only problem is when I click it (Hide) it hides columns DFJ and L and
changes to UNHIDE, but the UNHIDE box now looks anemic, the borders
especially (with the grayed-out look).. What am I missing to have it look
comparable to my HIDE button look?


Private Sub ToggleButton1_Click()
With Range("D:D,F:F,J:J,L:L")
If ToggleButton1.Value = True Then
.EntireColumn.Hidden = True
ToggleButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
ToggleButton1.Caption = "Hide"
End If
End With
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Button from Control Box

JMay

That's how ToggleButtons are supposed to work. It gives you a visual
identifier of what the value of the ToggleButton is: Normal = True, Anemic =
False.

If you want it to look normal all the time (with only the caption changing),
use a CommandButton instead of a ToggleButton.

Private Sub CommandButton1_Click()

With Me.Range("D:D,F:F,J:J,L:L")
If Me.CommandButton1.Caption = "Hide" Then
.EntireColumn.Hidden = True
Me.CommandButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
Me.CommandButton1.Caption = "Hide"
End If
End With

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"JMay" wrote in message news:QJMZb.8209$iB.4889@lakeread06...
I have a button created from the ControlBox that has in its Caption
properties HIDE.
The Hide Button looks very rich (dark and bold) as is (When I open the
Workbook).
It is working Ok based on the code below.
Only problem is when I click it (Hide) it hides columns DFJ and L and
changes to UNHIDE, but the UNHIDE box now looks anemic, the borders
especially (with the grayed-out look).. What am I missing to have it look
comparable to my HIDE button look?


Private Sub ToggleButton1_Click()
With Range("D:D,F:F,J:J,L:L")
If ToggleButton1.Value = True Then
.EntireColumn.Hidden = True
ToggleButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
ToggleButton1.Caption = "Hide"
End If
End With
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Button from Control Box

Tks Tom and Dick;

"Dick Kusleika" wrote in message
...
JMay

That's how ToggleButtons are supposed to work. It gives you a visual
identifier of what the value of the ToggleButton is: Normal = True, Anemic

=
False.

If you want it to look normal all the time (with only the caption

changing),
use a CommandButton instead of a ToggleButton.

Private Sub CommandButton1_Click()

With Me.Range("D:D,F:F,J:J,L:L")
If Me.CommandButton1.Caption = "Hide" Then
.EntireColumn.Hidden = True
Me.CommandButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
Me.CommandButton1.Caption = "Hide"
End If
End With

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"JMay" wrote in message

news:QJMZb.8209$iB.4889@lakeread06...
I have a button created from the ControlBox that has in its Caption
properties HIDE.
The Hide Button looks very rich (dark and bold) as is (When I open the
Workbook).
It is working Ok based on the code below.
Only problem is when I click it (Hide) it hides columns DFJ and L and
changes to UNHIDE, but the UNHIDE box now looks anemic, the borders
especially (with the grayed-out look).. What am I missing to have it

look
comparable to my HIDE button look?


Private Sub ToggleButton1_Click()
With Range("D:D,F:F,J:J,L:L")
If ToggleButton1.Value = True Then
.EntireColumn.Hidden = True
ToggleButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
ToggleButton1.Caption = "Hide"
End If
End With
End Sub






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control Button jai Excel Discussion (Misc queries) 2 August 25th 07 07:26 AM
Control box and button oxicottin Excel Discussion (Misc queries) 4 January 23rd 07 03:03 PM
Control or VBA programming a button brianv Excel Programming 5 December 12th 03 02:26 PM
ActiveX Control Button Mark[_22_] Excel Programming 2 October 18th 03 05:16 PM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM


All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"