The macro was intended to be used with form fields. What *exactly* are you
trying to do?
--
Graham Mayor - Word MVP
My web site
www.gmayor.com
Word MVP web site
http://word.mvps.org
Stan wrote:
I tried this excellent macro, but, I guess it won't work on mail merge
fields. I'm not a programmer, so if you have any suggestions, I'd be
much obliged. Thanks!
"Graham Mayor" wrote:
You don't have a form field called Text1 or in the case of the
second macro Text2. Change the names to match your field names.
--
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
inay wrote:
Hi Greg
When i test the below script by inserting it into a word document i
get an error message 'requested collection not available'. Do you
know what might be causing this?
Thanks,
Yani
"Greg" wrote:
Patricia,
Here is a few macro options that you set to run on exit from the
formfield that should give you a start:
Sub Format()
Dim oDoc As Document
Set oDoc = ActiveDocument
If oDoc.FormFields("Text1").Result "50" Then
oDoc.FormFields("Text1").Range.Font.Color = wdColorBrightGreen
Else
oDoc.FormFields("Text1").Range.Font.Color = wdColorAutomatic
End If
End Sub
Sub ColorField()
Dim content As String
With ActiveDocument.FormFields("Text2")
content = .Result
Select Case LCase(content)
Case "yes":
.Range.Font.Color = wdColorGreen
Case "no":
.Range.Font.Color = wdColorRed
Case Else:
.Range.Font.Color = wdColorAutomatic
End Select
End With
End Sub