|
原来的代码的点罗嗦,改一下:
Sub test1()
Dim ar(1 To 5), br(1 To 5), i&, mydoc As Document, thisdoc As Document, doc As Range
Set thisdoc = ThisDocument
For i = 1 To 5
ar(i) = i
Next i
ar(1) = 3: ar(3) = 1: ar(2) = 5: ar(5) = 2
Set mydoc = Documents.Add(, , , 0)
For i = 1 To 5
mydoc.Bookmarks("\endofdoc").Range.FormattedText = thisdoc.Paragraphs(ar(i)).Range.FormattedText
Next i
mydoc.Paragraphs(mydoc.Paragraphs.Count).Range.Delete
With thisdoc.Paragraphs(1).Range
.Collapse
.MoveEnd 4, 5
.FormattedText = mydoc.Range.FormattedText
End With
mydoc.Close 0
End Sub |
|