|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
楼主,下面只完成了第一步,试试:(创建副本后,在副本中把题号完成顺序编号)
Sub aaa整理题号()
'创建副本
ActiveDocument.SaveAs FileName:=ActiveDocument.Path & "\" & Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4) & "_副本" & ".doc"
Dim i As Paragraph, j As Long, k As Long
For Each i In ActiveDocument.Paragraphs
If i.Range Like "#.*" Or i.Range Like "##.*" Or i.Range Like "###.*" Then
i.Range.Font.Color = wdColorPink
k = InStr(i.Range, ".")
i.Range.Select
Selection.MoveEnd Unit:=wdCharacter, Count:=-(Len(i.Range) - (k - 1))
j = j + 1
Selection.Text = j
End If
Next
End Sub |
|