|
发表于 2015-9-19 07:33
|
显示全部楼层
本楼为最佳答案
wordvba貌似没有高效的办法- Sub Macro1()
- On Error Resume Next
- Application.ScreenUpdating = False
- Dim i&, n&, ks&, js&
- With ActiveDocument
- n = .Characters.Count
- If .Characters(1).HighlightColorIndex = wdYellow Then ks = 0
- For i = 1 To n - 1
- If .Characters(i - 1).HighlightColorIndex <> wdYellow And .Characters(i).HighlightColorIndex = wdYellow Then ks = i - 1
- If .Characters(i).HighlightColorIndex = wdYellow And .Characters(i + 1).HighlightColorIndex <> wdYellow Then
- js = i: .Range(ks, js) = "#"
- End If
- Next
- If .Characters(n).HighlightColorIndex = wdYellow Then js = n: .Range(ks, js) = "#"
- End With
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
查看全部评分
|