View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default change colour of disabled textbox text

Basil,

I think this is the preferred alternative. I was just reading about this in
Professional Excel Development the other day, don't know if I've got it
exactly right, though. It locks the textbox so can't be changed. One
benefit is that the user can still cut and paste the text in the textbox to
another locaiton, if needed. I changed the backcolor to the same color as
the buttons, so it indicates that you can't change it.:

Private Sub CommandButton1_Click()
Me.TextBox1.Locked = True
Me.TextBox1.BackColor = vbButtonFace
Me.TextBox1.ForeColor = vbRed
End Sub

hth,

Doug

"Basil" wrote in message
...
Hiya,

I have created a userform. There are 2 option buttons at the top - if they
select one, it will automatically diable all the textboxes on the

userform.
If they select the other, it enables all the textboxes.

The problem is that when the textboxes are disabled, the colour of the

text
within them goes grey and makes it hard to read (I need the users to be

able
to see the textbox contents very clearly, even when disabled).

Is there a way that I can stop the disabling of a textbox from greying all
the textbox contents? Ideally I would like the content to go red, but

staying
with the black would be fine.

Thanks,

Basil