|
唐兄:楼上代码作废!因为如果每个段落含有一个绿色字符,那么楼上代码是正确的!但是,如果某个段落含有两个或以上绿色字符时,请应用下面的宏:
- Sub test提取绿色段落到新建文档()
- Dim r As Range, a As Range, s$
- Set r = ActiveDocument.Content
- Set a = ActiveDocument.Content
- With r.Find
- .ClearFormatting
- .Text = ""
- .Font.Color = wdColorGreen
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- s = s & .Paragraphs(1).Range.Text
- If r.Paragraphs(1).Range.End = a.End Then Exit Do
- r.SetRange Start:=r.Next(4, 1).Start, End:=a.End
- End With
- Loop
- End With
- Documents.Add.Content = s
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|