toggle button text color

G

Guest

is it possible to change the text color of a toggle button text depending
whether the toggle button value is true or false
 
D

Dave Peterson

This worked ok for me:

Option Explicit
Private Sub ToggleButton1_Click()
With Me.ToggleButton1
If .Value = True Then
.ForeColor = &H8000000D
Else
.ForeColor = &HFF&
End If
End With
End Sub
 
K

keithl816

How can this be changed so that when the button is out it is black and
when it is pushed in it is red?

Larry
 
P

Peo Sjoblom

Don't think that's possible, you can change the text colour in the button's
properties but I don't know of a way to have 2 different colours
 
K

keithl816

Daves code works but the font in the button comes up green, what needs
to be changed so that it is black instead of green? I've changed the
true to false so that the red shows up when ther button is pushed in,
when it's out it is green.

CODE]
If .Value = True Then
..ForeColor = &H8000000D
Else
..ForeColor = &HFF&
End If

--------------------


Thanks

Larry
 
K

keithl816

I figured it out.

Thanks


Code
-------------------

With Me.ToggleButton1
If .Value = False Then
.ForeColor = &H0
Else
.ForeColor = &HFF&
End If
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top