Re: [转载] Please Help on word 2000 with VBA !# Programming - 葵花宝典
j*e
1 楼
Sub SeparatePagesFromDocument()
Dim rng As Range
Dim i As Integer
Dim oDoc As Document, nDoc As Document
Set oDoc = ActiveDocument
For i = 1 To oDoc.BuiltInDocumentProperties(wdPropertyPages)
Set rng = oDoc.GoTo(what:=wdGoToPage, which:=wdGoToAbsolute, Count:=i)
rng.Select
Set rng = Selection.Bookmarks("\page").Range
rng.Select
rng.Copy
Set nDoc = Documents.Add
nDoc.Range.PasteSpecial
nDoc.SaveAs "C:\temp\" & Replace(oDoc.Name, ".doc", "") & "-Part-" & i
nDoc.Close
Next i
Set r
Dim rng As Range
Dim i As Integer
Dim oDoc As Document, nDoc As Document
Set oDoc = ActiveDocument
For i = 1 To oDoc.BuiltInDocumentProperties(wdPropertyPages)
Set rng = oDoc.GoTo(what:=wdGoToPage, which:=wdGoToAbsolute, Count:=i)
rng.Select
Set rng = Selection.Bookmarks("\page").Range
rng.Select
rng.Copy
Set nDoc = Documents.Add
nDoc.Range.PasteSpecial
nDoc.SaveAs "C:\temp\" & Replace(oDoc.Name, ".doc", "") & "-Part-" & i
nDoc.Close
Next i
Set r