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

How can I make the caption of the toggle button to change based on wether it
is on or off.

On/Off Yes/No

just something simple like that.

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Toggle Button

Hi there

you could use something like this

Private Sub ToggleButton1_Click()

If ToggleButton1.Value = True Then
ToggleButton1.Caption = "On"
Else
ToggleButton1.Caption = "Off"
End If

End Sub

Hope this helps


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Toggle Button

Perfect

Thanks!

Incidental wrote:
Hi there

you could use something like this

Private Sub ToggleButton1_Click()

If ToggleButton1.Value = True Then
ToggleButton1.Caption = "On"
Else
ToggleButton1.Caption = "Off"
End If

End Sub

Hope this helps


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Toggle Button

Whilst I would maybe question the logic of doing this because:
- The idea of the control is that its state is visible from its appearance
- Will the user be confused if they should click it to make if Off, or it
currently is Off. I prefer the CheckBox for clarity.

Ignores the Null state, which you can add if desired.

Private Sub ToggleButton1_Click()

With ToggleButton1
If .Value = True Then
.Caption = "On"
Else
.Caption = "Off"
End If
End With

End Sub

NickHK

"blackbox via OfficeKB.com" <u20390@uwe wrote in message
news:7355a9b84c3b2@uwe...
How can I make the caption of the toggle button to change based on wether

it
is on or off.

On/Off Yes/No

just something simple like that.

--
Message posted via http://www.officekb.com



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
Toggle Button Squeaky Excel Worksheet Functions 0 September 17th 08 04:14 PM
Toggle Button mick2 Excel Discussion (Misc queries) 5 November 27th 05 05:52 AM
Toggle Button Dave_2k5 Excel Discussion (Misc queries) 2 September 1st 05 11:27 AM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM
Toggle Button Ben E[_2_] Excel Programming 1 October 29th 03 04:42 PM


All times are GMT +1. The time now is 02:52 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"