WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Can you change the background color of a check box?

 
   Home -> Office -> Document Management RSS
Next:  Last Cursor Location  
Author Message
Jolibeanz

External


Since: Oct 10, 2008
Posts: 4



(Msg. 1) Posted: Tue Sep 15, 2009 7:29 am
Post subject: Can you change the background color of a check box?
Archived from groups: microsoft>public>word>docmanagement (more info?)

I am creating a protected form that will be using a number of check boxes.
We'd like to use a 3 color coding system - green (good); yellow (needs
attention soon) and red (needs immediate attention).

I've tried coloring the cell the check block resides in, but it does not
give the visual impact we had hoped for. Using 3 colored squares gives the
appearance but not the convenience of a check block. Any suggestions?
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 8454



(Msg. 2) Posted: Tue Sep 15, 2009 11:05 am
Post subject: Re: Can you change the background color of a check box? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

See the example 'Colour a form field check box with a contrasting colour
when it is checked'. at http://www.gmayor.com/word_vba_examples.htm and you
may be able to use the bar chart example also?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



Jolibeanz wrote:
> I am creating a protected form that will be using a number of check
> boxes. We'd like to use a 3 color coding system - green (good);
> yellow (needs attention soon) and red (needs immediate attention).
>
> I've tried coloring the cell the check block resides in, but it does
> not give the visual impact we had hoped for. Using 3 colored squares
> gives the appearance but not the convenience of a check block. Any
> suggestions?
Back to top
Login to vote
Jolibeanz

External


Since: Oct 10, 2008
Posts: 4



(Msg. 3) Posted: Tue Sep 15, 2009 11:05 am
Post subject: Re: Can you change the background color of a check box? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Not exactly what I was looking for, but definately food for thought. For my
application I would need to create 3 macros (one for each color) and apply
the appropriate one to each box. Correct? Also, siince I'm a relative macro
newb, in the macro where it says "Password:=sPassword" - I would insert the
password for that document in place of the "sPassword"?

"Graham Mayor" wrote:

> See the example 'Colour a form field check box with a contrasting colour
> when it is checked'. at http://www.gmayor.com/word_vba_examples.htm and you
> may be able to use the bar chart example also?
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
>
> Jolibeanz wrote:
> > I am creating a protected form that will be using a number of check
> > boxes. We'd like to use a 3 color coding system - green (good);
> > yellow (needs attention soon) and red (needs immediate attention).
> >
> > I've tried coloring the cell the check block resides in, but it does
> > not give the visual impact we had hoped for. Using 3 colored squares
> > gives the appearance but not the convenience of a check block. Any
> > suggestions?
>
>
>
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 8454



(Msg. 4) Posted: Wed Sep 16, 2009 2:05 am
Post subject: Re: Can you change the background color of a check box? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

No - you only need the one macro, but it needs fine tuning to ensure the
correct colour is selected.

Let's assume that the three fields are Check1 (Red), Check2 (Orange), and
Check3 (Green), then the following will colour those check boxes
accordingly. If you have more than one set of check boxes, say Check4 (Red),
Check5 (Orange), and Check6 (Green) then add the box names to the case
statements eg

Case "Check1", "Check4"
Etc
Case "Check2", "Check5"
Etc
Case "Check3", "Check6"
Etc

The password for the form goes between the quotes in the line
sPassword = ""

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Private mstrFF As String
Sub EmphasiseCheckedBox()
Dim oFld As FormFields
Dim sCount As Integer
Dim bProtected As Boolean
Dim sPassword As String
sPassword = "" 'Insert the password (if any), used to protect the form
between the quotes
With GetCurrentFF 'Establish field is current
mstrFF = GetCurrentFF.name
End With
Set oFld = ActiveDocument.FormFields
sCount = oFld(mstrFF).CheckBox.Value 'Get the Checkbox field value
'Check if the document is protected and if so unprotect it
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=sPassword
End If
With oFld(mstrFF).Range
If sCount = True Then
Select Case oFld(mstrFF).name
Case "Check1"
.Font.Color = wdColorRed
Case "Check2"
.Font.Color = wdColorOrange
Case "Check3"
.Font.Color = wdColorGreen
End Select
Else
.Font.Color = wdColorAutomatic 'Set the colour of the unchecked
box
End If
End With
'Re-protect the form and apply the password (if any).
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=sPassword
End If
End Sub
Private Function GetCurrentFF() As Word.FormField
Dim rngFF As Word.Range
Dim fldFF As Word.FormField
Set rngFF = Selection.Range
rngFF.Expand wdParagraph
For Each fldFF In rngFF.FormFields
Set GetCurrentFF = fldFF
Exit For
Next
End Function


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Jolibeanz wrote:
> Not exactly what I was looking for, but definately food for thought.
> For my application I would need to create 3 macros (one for each
> color) and apply the appropriate one to each box. Correct? Also,
> siince I'm a relative macro newb, in the macro where it says
> "Password:=sPassword" - I would insert the password for that document
> in place of the "sPassword"?
>
> "Graham Mayor" wrote:
>
>> See the example 'Colour a form field check box with a contrasting
>> colour when it is checked'. at
>> http://www.gmayor.com/word_vba_examples.htm and you may be able to
>> use the bar chart example also?
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>>
>> Jolibeanz wrote:
>>> I am creating a protected form that will be using a number of check
>>> boxes. We'd like to use a 3 color coding system - green (good);
>>> yellow (needs attention soon) and red (needs immediate attention).
>>>
>>> I've tried coloring the cell the check block resides in, but it does
>>> not give the visual impact we had hoped for. Using 3 colored
>>> squares gives the appearance but not the convenience of a check
>>> block. Any suggestions?
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 8454



(Msg. 5) Posted: Wed Sep 16, 2009 2:05 am
Post subject: Re: Can you change the background color of a check box? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I managed to insert an extra signature block Surprised( so with some news readers
you may not see the modified code, which was:

Private mstrFF As String
Sub EmphasiseCheckedBox()
Dim oFld As FormFields
Dim sCount As Integer
Dim bProtected As Boolean
Dim sPassword As String
sPassword = "" 'Insert the password (if any), used to protect the form
between the quotes
With GetCurrentFF 'Establish field is current
mstrFF = GetCurrentFF.name
End With
Set oFld = ActiveDocument.FormFields
sCount = oFld(mstrFF).CheckBox.Value 'Get the Checkbox field value
'Check if the document is protected and if so unprotect it
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=sPassword
End If
With oFld(mstrFF).Range
If sCount = True Then
Select Case oFld(mstrFF).name
Case "Check1"
.Font.Color = wdColorRed
Case "Check2"
.Font.Color = wdColorOrange
Case "Check3"
.Font.Color = wdColorGreen
End Select
Else
.Font.Color = wdColorAutomatic 'Set the colour of the unchecked
box
End If
End With
'Re-protect the form and apply the password (if any).
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=sPassword
End If
End Sub
Private Function GetCurrentFF() As Word.FormField
Dim rngFF As Word.Range
Dim fldFF As Word.FormField
Set rngFF = Selection.Range
rngFF.Expand wdParagraph
For Each fldFF In rngFF.FormFields
Set GetCurrentFF = fldFF
Exit For
Next
End Function


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Graham Mayor wrote:
> No - you only need the one macro, but it needs fine tuning to ensure
> the correct colour is selected.
>
> Let's assume that the three fields are Check1 (Red), Check2 (Orange),
> and Check3 (Green), then the following will colour those check boxes
> accordingly. If you have more than one set of check boxes, say Check4
> (Red), Check5 (Orange), and Check6 (Green) then add the box names to
> the case statements eg
>
> Case "Check1", "Check4"
> Etc
> Case "Check2", "Check5"
> Etc
> Case "Check3", "Check6"
> Etc
>
> The password for the form goes between the quotes in the line
> sPassword = ""
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> Private mstrFF As String
> Sub EmphasiseCheckedBox()
> Dim oFld As FormFields
> Dim sCount As Integer
> Dim bProtected As Boolean
> Dim sPassword As String
> sPassword = "" 'Insert the password (if any), used to protect the form
> between the quotes
> With GetCurrentFF 'Establish field is current
> mstrFF = GetCurrentFF.name
> End With
> Set oFld = ActiveDocument.FormFields
> sCount = oFld(mstrFF).CheckBox.Value 'Get the Checkbox field value
> 'Check if the document is protected and if so unprotect it
> If ActiveDocument.ProtectionType <> wdNoProtection Then
> bProtected = True
> ActiveDocument.Unprotect Password:=sPassword
> End If
> With oFld(mstrFF).Range
> If sCount = True Then
> Select Case oFld(mstrFF).name
> Case "Check1"
> .Font.Color = wdColorRed
> Case "Check2"
> .Font.Color = wdColorOrange
> Case "Check3"
> .Font.Color = wdColorGreen
> End Select
> Else
> .Font.Color = wdColorAutomatic 'Set the colour of the
> unchecked box
> End If
> End With
> 'Re-protect the form and apply the password (if any).
> If bProtected = True Then
> ActiveDocument.Protect _
> Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=sPassword
> End If
> End Sub
> Private Function GetCurrentFF() As Word.FormField
> Dim rngFF As Word.Range
> Dim fldFF As Word.FormField
> Set rngFF = Selection.Range
> rngFF.Expand wdParagraph
> For Each fldFF In rngFF.FormFields
> Set GetCurrentFF = fldFF
> Exit For
> Next
> End Function
>
>
>
> Jolibeanz wrote:
>> Not exactly what I was looking for, but definately food for thought.
>> For my application I would need to create 3 macros (one for each
>> color) and apply the appropriate one to each box. Correct? Also,
>> siince I'm a relative macro newb, in the macro where it says
>> "Password:=sPassword" - I would insert the password for that document
>> in place of the "sPassword"?
>>
>> "Graham Mayor" wrote:
>>
>>> See the example 'Colour a form field check box with a contrasting
>>> colour when it is checked'. at
>>> http://www.gmayor.com/word_vba_examples.htm and you may be able to
>>> use the bar chart example also?
>>>
>>> --
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>> Graham Mayor - Word MVP
>>>
>>> My web site www.gmayor.com
>>> Word MVP web site http://word.mvps.org
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>>
>>>
>>>
>>> Jolibeanz wrote:
>>>> I am creating a protected form that will be using a number of check
>>>> boxes. We'd like to use a 3 color coding system - green (good);
>>>> yellow (needs attention soon) and red (needs immediate attention).
>>>>
>>>> I've tried coloring the cell the check block resides in, but it
>>>> does not give the visual impact we had hoped for. Using 3 colored
>>>> squares gives the appearance but not the convenience of a check
>>>> block. Any suggestions?
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Document Management All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support