K
kbutterly
Good morning all,
I have some code that I want to use to color code text based on the
style name. The code runs fine, but font color does not change for one
of the styles. Here is the code:
For Each st In ActiveDocument.Styles
If InStr(st.NameLocal, "Agency") > 0 Then
st.Font.Color = wdColorBrightGreen
st.Font.Hidden = False
ElseIf InStr(st.NameLocal, "PO") > 0 Then
st.Font.Color = wdColorBrightGreen
st.Font.Hidden = False
End If
Next
The code changes the color of the text with style 'Body Text Agency' to
bright green, but does not change the color of the text with style
'Body Text PO'.
Both styles are paragragh styles. They are both based on style 'Body
Text'
When I step through the code, st.Font.Color changes from -16777216 to
65280 for both styles. If I go to Paragraph Styles, 'Body Text PO'
shows that it is formatted as bright green. However, while 'Body Text
Agency' appears bright green, 'Body Text PO' still appears black on the
screen.
Am I missing somethign obvious here? Any ideas, references, or
resources would be greatly appreciated.
Thanks,
Kathryn
I have some code that I want to use to color code text based on the
style name. The code runs fine, but font color does not change for one
of the styles. Here is the code:
For Each st In ActiveDocument.Styles
If InStr(st.NameLocal, "Agency") > 0 Then
st.Font.Color = wdColorBrightGreen
st.Font.Hidden = False
ElseIf InStr(st.NameLocal, "PO") > 0 Then
st.Font.Color = wdColorBrightGreen
st.Font.Hidden = False
End If
Next
The code changes the color of the text with style 'Body Text Agency' to
bright green, but does not change the color of the text with style
'Body Text PO'.
Both styles are paragragh styles. They are both based on style 'Body
Text'
When I step through the code, st.Font.Color changes from -16777216 to
65280 for both styles. If I go to Paragraph Styles, 'Body Text PO'
shows that it is formatted as bright green. However, while 'Body Text
Agency' appears bright green, 'Body Text PO' still appears black on the
screen.
Am I missing somethign obvious here? Any ideas, references, or
resources would be greatly appreciated.
Thanks,
Kathryn