![]() |
|
#1
|
|||
|
|||
|
hi all, wondering if it's possible to use find/replace to manage font colours?
i'm wanting to find all text that isn't a specific RGB, and then depending on where it is in the document, set it to the standard RGB this is what i have so far which does work, i'm just wondering if this is possible with find/replace in a range, or if there is a better way? thanks! Code:
Private Sub Get_Non_Grey_Font_Colour()
'
' affects ALL document content - ignores tables and charts
'
' find text not in 80% grey
'
Dim objPara As Paragraph
Dim lng80PercentGrey As Long
Dim rngTemp As Range
lng80PercentGrey = RGB(80, 84, 77)
For Each objPara In ActiveDocument.Paragraphs
If objPara.Range.Font.TextColor <> lng80PercentGrey Then
objPara.Range.Select
If Selection.Information(wdWithInTable) Then
Set rngTemp = Selection.tables(1).Range
rngTemp.Collapse wdCollapseEnd
rngTemp.Select
Else
objPara.Range.Select
objPara.Range.Font.TextColor = lng80PercentGrey
End If
End If
Next objPara
Set objPara = Nothing
Set rngTemp = Nothing
Debug.Print Now & " - " & "finished!"
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How do I select all text highlighted in a specific colour?
|
bertietheblue | Word | 2 | 04-15-2016 12:30 PM |
Find/replace font colour in all header/footer
|
trillium | Word VBA | 4 | 10-20-2015 10:39 PM |
VBA Table – Search All Tables - Find & Replace Text in Table Cell With Specific Background Color
|
jc491 | Word VBA | 8 | 09-30-2015 06:10 AM |
| Word VBA Find Table Text Shading Colour and replace with another | QA_Compliance_Advisor | Word VBA | 10 | 09-19-2014 08:36 AM |
Quickest way to change text to Arial size 11 specific colour
|
BlueClearSky | Word | 6 | 11-22-2013 03:34 PM |