Note: the line fn = "Page" + CStr(idx) + ".doc" contains the name of the files. You can change this to your liking. For example, if you wanted them stored in c:\temp, you would write something like: fn = "c:\temp\Page" + CStr(idx)
Dim orig As Document
Dim page As Document
Dim numPages As Integer
Dim idx As Integer
Dim fn As String
' Keep a reference to the current document.
Set orig = ActiveDocument
' Calculate the number of pages
numPages = ActiveDocument.Range.Information(wdActiveEndPageNumber)
For idx = 1 To numPages
' Make sure the document is active
' Go to the page with index idx
Selection.GoTo What:=wdGoToPage, Name:=idx
' Select the current page
Selection.GoTo What:=wdGoToBookmark, Name:="\page"
' Copy the selection
' Create a new document
Set page = Documents.Add
' Activate it
' Paste the selection
' Generate the file name
fn = "Page" + CStr(idx) + ".doc"
' Save the document as Word 97-2003
page.SaveAs FileName:=fn, FileFormat:=wdFormatDocument, AddToRecentFiles:=False
' Close the document
51 people were helped by this reply
Did this solve your problem?
Sorry this didn't help.
Great! Thanks for marking this as the answer.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.