上面一段宏运行结束后再运行以下宏: Sub InsertTime()
Dim i As Paragraph, n As Integer, TimeStr As String
On Error Resume Next
Application.ScreenUpdating = False
For Each i In ActiveDocument.Paragraphs
If n < 10 Then
TimeStr = "[00:0" & n & ".00]"
ElseIf n = 60 Then
TimeStr = "[01:00.00]"
n = 0
Else
TimeStr = "[00:" & n & ".00]"
End If
i.Range.InsertBefore TimeStr
n = n + 5
Next
Application.ScreenUpdating = True
End Sub
‘也可以两段加起来中间用模块名如: Sub CreateLine()
Dim i As Long, n As Integer
On Error Resume Next
Application.ScreenUpdating = False
With ActiveDocument
.Content.Find.Execute FindText:="^p", ReplaceWith:="", Replace:=wdReplaceAll
For i = 0 To .Content.End Step 10
.Range(i, i + 10 + n).InsertAfter Chr(13)
n = n + 1
Next
End With
Application.ScreenUpdating = True
InsertTime
End Sub
Sub InsertTime()
Dim i As Paragraph, n As Integer, TimeStr As String
On Error Resume Next
Application.ScreenUpdating = False
For Each i In ActiveDocument.Paragraphs
If n < 10 Then
TimeStr = "[00:0" & n & ".00]"
ElseIf n = 60 Then
TimeStr = "[01:00.00]"
n = 0
Else
TimeStr = "[00:" & n & ".00]"
End If
i.Range.InsertBefore TimeStr
n = n + 5
Next
Application.ScreenUpdating = True
End Sub
|