|
* 楼主,如果你的系统是 Win10-64位系统,应该将代码粘贴到新建文档中,再"全选",复制到 VBE 中;否则,可能会乱码。
- Sub aaaa_重新编号_624()
- '不选则全选
- On Error Resume Next
- Dim r As Range, i As Paragraph, n&
- Set r = IIf(Selection.Type = wdSelectionIP, ActiveDocument.Content, Selection.Range)
- For Each i In r.Paragraphs
- With i.Range
- If .Text Like "#?*" Or .Text Like "##?*" Or .Text Like "###?*" Or .Text Like "####?*" Then
- n = n + 1
- ActiveDocument.Range(Start:=.Characters(1).Start, End:=.Characters(InStr(.Text, "、")).End).Delete
- ActiveDocument.Range(Start:=.Characters(1).Start, End:=.Characters(InStr(.Text, ".")).End).Delete
- ActiveDocument.Range(Start:=.Characters(1).Start, End:=.Characters(InStr(.Text, ".")).End).Delete
- .InsertBefore Text:=n & "."
- Else
- n = 0
- End If
- End With
- Next
- If r <> ActiveDocument.Content Then r.Select
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|