PC Review


Reply
Thread Tools Rate Thread

How do I change the forecolor of a CheckBox when True

 
 
PJ Murph
Guest
Posts: n/a
 
      10th Apr 2009

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      10th Apr 2009
Try code like the following:


Private Sub CheckBox1_Click()
With Me.CheckBox1
If .Value <> 0 Then
' checked
.ForeColor = RGB(255, 0, 0) ' Red
Else
' unchecked
.ForeColor = RGB(0, 0, 255) ' Blue
End If
End With
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)





On Fri, 10 Apr 2009 13:24:03 -0700, PJ Murph
<(E-Mail Removed)> wrote:

 
Reply With Quote
 
PJ Murph
Guest
Posts: n/a
 
      10th Apr 2009
How do I adapt your code into this?
'Public WithEvents CBXGroup As MSForms.CheckBox
Private Sub CBXGroup_Change()'
WhichOne = Mid(CBXGroup.Name, Len("cbxFee") + 1)
With CBXGroup.Parent.OLEObjects("cbxFee" & WhichOne)
.PrintObject = CBXGroup.Value
End With

"Chip Pearson" wrote:

> Try code like the following:
>
>
> Private Sub CheckBox1_Click()
> With Me.CheckBox1
> If .Value <> 0 Then
> ' checked
> .ForeColor = RGB(255, 0, 0) ' Red
> Else
> ' unchecked
> .ForeColor = RGB(0, 0, 255) ' Blue
> End If
> End With
> End Sub
>
>
> Cordially,
> Chip Pearson
> Microsoft Most Valuable Professional
> Excel Product Group, 1998 - 2009
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email on web site)
>
>
>
>
>
> On Fri, 10 Apr 2009 13:24:03 -0700, PJ Murph
> <(E-Mail Removed)> wrote:
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      11th Apr 2009
With cbxgroup.parent.oleobjects("cbxfee" & whichone)
.printobject = cbxgroup.value
with .object
If .Value = True Then
.ForeColor = RGB(255, 0, 0) ' Red
Else
.ForeColor = RGB(0, 0, 255)
End If
end with
End With

(Untested, uncompiled. Watch for typos.)

PJ Murph wrote:
>
> How do I adapt your code into this?
> 'Public WithEvents CBXGroup As MSForms.CheckBox
> Private Sub CBXGroup_Change()'
> WhichOne = Mid(CBXGroup.Name, Len("cbxFee") + 1)
> With CBXGroup.Parent.OLEObjects("cbxFee" & WhichOne)
> .PrintObject = CBXGroup.Value
> End With
>
> "Chip Pearson" wrote:
>
> > Try code like the following:
> >
> >
> > Private Sub CheckBox1_Click()
> > With Me.CheckBox1
> > If .Value <> 0 Then
> > ' checked
> > .ForeColor = RGB(255, 0, 0) ' Red
> > Else
> > ' unchecked
> > .ForeColor = RGB(0, 0, 255) ' Blue
> > End If
> > End With
> > End Sub
> >
> >
> > Cordially,
> > Chip Pearson
> > Microsoft Most Valuable Professional
> > Excel Product Group, 1998 - 2009
> > Pearson Software Consulting, LLC
> > www.cpearson.com
> > (email on web site)
> >
> >
> >
> >
> >
> > On Fri, 10 Apr 2009 13:24:03 -0700, PJ Murph
> > <(E-Mail Removed)> wrote:
> >
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox Control - How to display a true or false value in the cellcontaining a checkbox Dave K Microsoft Excel Discussion 1 8th Sep 2010 08:31 PM
How to make all controls disable foreColor and BackColor same as ReadOnly = true? ABC Microsoft Dot NET Framework Forms 2 9th Aug 2006 01:35 PM
Trying to change ForeColor accordingly Gina Microsoft Access Form Coding 5 15th Mar 2005 03:17 PM
Forecolor Change =?Utf-8?B?cmtibmFpcg==?= Microsoft ASP .NET 4 25th Jan 2005 03:07 PM
Re: Forecolor change Pavel Romashkin Microsoft Access Forms 0 25th Feb 2004 08:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:23 PM.