|
楼主,我有两个小宏test1/test2,虽然功能一样,但test1是极简的!请试用:
- Sub test1()
- ActiveDocument.Content.Find.Execute "[^13^11 ^s^t]@(出席:)", , , 1, , , , , , "^p^p\1", 2
- End Sub
- Sub test2()
- With ActiveDocument
- '回车符/手动换行符=>段落标记
- .Content.Find.Execute "[^13^11]", , , 1, , , , , , "^p", 2
- .Select
- CommandBars.FindControl(ID:=122).Execute
- CommandBars.FindControl(ID:=123).Execute
- '删除空行
- Dim i As Paragraph
- For Each i In .Paragraphs
- If Asc(i.Range) = 13 Then i.Range.Delete
- Next
- '插入空行
- With .Content.Find
- .ClearFormatting
- .Text = "^13出席:"
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- .InsertParagraphBefore
- .Start = .End
- End With
- Loop
- End With
- .Range(0, 0).Select
- End With
- End Sub
复制代码 |
|