|
413191246se兄好!原来我前面没上传到代码。这个以前也讨论有过的,我想其实处理思路应该差不多的- Sub test()
- '突出显示文档中表格外的内容
- Dim i%, myRange()
-
- With ActiveDocument
- ReDim myRange(.Tables.Count + 1)
- If .Tables.Count > 0 Then
- Set myRange(0) = .Range(0, 0)
- For i = 1 To .Tables.Count
- If i = 1 Then
- Set myRange(i) = .Range(0, .Tables(i).Range.Start)
- Else
- Set myRange(i) = .Range(.Tables(i - 1).Range.End, .Tables(i).Range.Start)
- End If
- Next
- Set myRange(i) = .Range(.Tables(i - 1).Range.End, .Content.End)
- Else
- Set myRange(1) = .Content
- End If
- End With
-
- For i = 1 To UBound(myRange)
- myRange(i).HighlightColorIndex = wdYellow
- Next
- End Sub
复制代码 |
|