|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test()
- Dim i&, j&, rng As Range
- Dim arr(1000) '*****
-
- i = 0
- Selection.HomeKey wdStory
-
- With Selection.Find
- .ClearFormatting
- .Text = "*"
- .MatchWildcards = True
- .Font.ColorIndex = wdRed
- .Forward = True
- Do While .Execute
- Set rng = Range(Start:=Selection.Start, End:=Selection.End)
- arr(i) = rng
- i = i + 1
- If Range(Start:=Selection.Start + 1, End:=Selection.End + 1).Font.ColorIndex <> wdRed Then arr(i) = vbCrLf: i = i + 1
- Loop
-
- j = UBound(arr)
- For i = 0 To j
- If arr(i) = "" Then Exit For
- Selection.EndKey wdStory
- Selection.Text = arr(i)
- Next
- End With
- End Sub
复制代码 |
|