Deleting Entire Page/Saving single pages

G

Greg

Gord,

You can't move pages around in Word like slides in
PowerPoint ;-(

You cand use a macro to delete the current page:

Sub DeletePage()
'
Selection.GoTo What:=wdGoToBookmark, Name:="\page"
Selection.Delete
End Sub

and to save each page as a new file.

Sub SaveEachPageOfCurrentDocumentAsANewDocument()
Dim pCounter As Long
Dim pNumPages As Long
Dim pParent As Document
Dim pChild As Document
Dim pParentName As String
Dim pChildName As String
Dim pChildNameRange As Range
Dim PathToUse As String

If ActiveDocument.Saved = False Then
Documents.Save NoPrompt:=False, _
OriginalFormat:=wdOriginalDocumentFormat
End If

With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

Set pParent = ActiveDocument

pParentName = pParent.FullName
Selection.HomeKey Unit:=wdStory
pNumPages = pParent.BuiltInDocumentProperties
(wdPropertyPages)
pCounter = 0
While pCounter < pNumPages
pCounter = pCounter + 1
pParent.Bookmarks("\Page").Range.Cut
Set pChild = Documents.Add
pChild.Range.Paste
Set pChildNameRange = pChild.Range
pChildNameRange.Collapse wdCollapseStart '
pChildNameRange.Expand Unit:=wdParagraph
pChildNameRange.MoveEnd Unit:=wdCharacter, Count:=-1
pChildName = pChildNameRange
pChild.SaveAs FileName:="" & PathToUse & "" &
pChildName & ""
pChild.Close
Wend
pParent.Close SaveChanges:=wdDoNotSaveChanges
Documents.Open pParentName
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top