B
Benjamino5
I need to search for all styles that are not on a whitelist of approved
styles. When I find an "illegal" style, I need to highlight the text in red.
So far, so good.
The problem is that end-of-row markers in tables get flagged if they have an
illegal style. I want them to be skipped, but I'm not sure how to approach
that. Any ideas?
Here's a code fragment:
___________________________________
' this is part of a loop; "s" is a style; "adoc" is the active document
'
If s.InUse = True And s.Type = 1 And Not IsInList(s.NameLocal, whitelist) Then
wd.app.options.DefaultHighlightColorIndex = 6 'wdRed
With adoc.range.Find
.ClearFormatting()
.Text = ""
.Style = s.NameLocal
.Replacement.Highlight = True
.Replacement.Text = ""
.Execute(Replace:=2, Format:=True) 'wdReplaceAll
If .Found = True Then
' something was found, but it MIGHT be an
end-of-cell marker
' how do I handle it here??
' add the name to the foundList and log
' if it's not in there already
If Not foundList.Contains(s.NameLocal + ",")
Then
foundList = foundList + s.NameLocal + ","
End If
End If
End With
End If
styles. When I find an "illegal" style, I need to highlight the text in red.
So far, so good.
The problem is that end-of-row markers in tables get flagged if they have an
illegal style. I want them to be skipped, but I'm not sure how to approach
that. Any ideas?
Here's a code fragment:
___________________________________
' this is part of a loop; "s" is a style; "adoc" is the active document
'
If s.InUse = True And s.Type = 1 And Not IsInList(s.NameLocal, whitelist) Then
wd.app.options.DefaultHighlightColorIndex = 6 'wdRed
With adoc.range.Find
.ClearFormatting()
.Text = ""
.Style = s.NameLocal
.Replacement.Highlight = True
.Replacement.Text = ""
.Execute(Replace:=2, Format:=True) 'wdReplaceAll
If .Found = True Then
' something was found, but it MIGHT be an
end-of-cell marker
' how do I handle it here??
' add the name to the foundList and log
' if it's not in there already
If Not foundList.Contains(s.NameLocal + ",")
Then
foundList = foundList + s.NameLocal + ","
End If
End If
End With
End If