|
Sub jimin()
Dim col As New Collection, k&, Crng As Range
Dim mt, oRang As Range, j%, n%, m%
Set Crng = ActiveDocument.Content
With CreateObject("vbscript.regexp")
.Pattern = "^[^\r]*?\r"
.Global = True: .MultiLine = True
For Each mt In .Execute(Crng)
k = k + 1
m = mt.FirstIndex: n = mt.Length
Set oRang = ActiveDocument.Range(Crng.Start + m, Crng.Start + m + n)
col.Add oRang, CStr(k)
Next
End With
For j = 1 To col.Count
With col(j).Font
' .Name = "黑体"
'.Name = "Times New Roman"
'.Bold = True
'.Color = wdColorPink
col(j).InsertBefore Text:=j & "."
End With
Next
End Sub |
|