Changing Font Color in Form

  • Thread starter Thread starter Lisa Mazzanti
  • Start date Start date
L

Lisa Mazzanti

I am creating a form in Word. When a negative number is entered in the text
form field I want the negative number to be in red instead of a parenthesis.

Can this be done?
 
Hello Lisa

Lisa said:
I am creating a form in Word. When a negative number is entered in the text
form field I want the negative number to be in red instead of a parenthesis.

yes, easily: in Excel! :-)

In Word, you'll probably need an on-exit macro assigned to the field
(that changes the color).

HTH
Robert
 
Assuming the field bookmark name is "Text1" then the following run on exit
from the field will format negative numbers in red.

Sub NegFormat()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
If oFld("Text1").Result < 1 Then
oFld("Text1").Range.Font.Color = wdColorRed
Else
oFld("Text1").Range.Font.Color = wdColorBlack
End If
End Sub

For a numeric field entry type set the field format to 0.00 or 0

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Hi Graham

Graham said:
Assuming the field bookmark name is "Text1" then the following run on exit
from the field will format negative numbers in red.

Sub NegFormat()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
If oFld("Text1").Result < 1 Then

< 0 ?

Greetinx
Robert
ps: no, I didn't test it! :-)
 

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

Back
Top