View Single Post
  #3   Report Post  
Dawnnil Dawnnil is offline
Junior Member
 
Posts: 0
Default

Hi Iceman,

Yes, you can save specific page as an individual document.

Here are 2 cases, each with a macro solution.

case 1. Extract Current Page and Save it as a New Document

Put cursor at a page you want to save as a file. Press "Alt+ F11" to open VBA editor.
Then create a new module and paste the following macro:

Sub SaveCurrentPageAsANewDoc()
Dim objNewDoc As Document
Dim objDoc As Document
Dim strFileName As String
Dim strFolder As String

' Initialization
Set objDoc = ActiveDocument

strFolder = InputBox("Enter folder path: ")
strFileName = InputBox("Enter file name: ")

' Copy current page.
objDoc.Bookmarks("\Page").Range.Select
Selection.Copy

' Open a new document to paste the selection.
Set objNewDoc = Documents.Add
Selection.Paste

objNewDoc.SaveAs FileName:=strFolder & "\" & strFileName & ".docx"
objNewDoc.Close
End Sub


Case 2: Extract Each Page and Save it as a New Document

Use the same way to create a new module and paste this macro:

Sub SaveEachPageAsADoc()
Dim objNewDoc As Document
Dim objDoc As Document
Dim nPageNumber As Integer
Dim strFolder As String
Dim objFileName As Range

' Initialization
Set objDoc = ActiveDocument

strFolder = InputBox("Enter folder path he ")

' Copy each page in the document to paste it into a new one.
For nPageNumber = 1 To ActiveDocument.ComputeStatistics(wdStatisticPages)
Application.Browser.Target = wdBrowsePage
ActiveDocument.Bookmarks("\page").Range.Select
Selection.Copy

Set objNewDoc = Documents.Add
Selection.Paste

' Save new doc with the name of "Page" & nPageNumber and get the first 20 characters of the new doc as part of the file name.
Set objFileName = objNewDoc.Range(Start:=0, End:=20)
objNewDoc.SaveAs FileName:=strFolder & "\" & "Page " & nPageNumber & " " & objFileName & ".docx"
objNewDoc.Close
Application.Browser.Next
Next nPageNumber
End Sub

This macro saves each page of your document as an individual file.

For more detailed information, you can refer to this article:

https://www.datanumen.com/blogs/2-qu...word-document/

Hope that helps!

Dawnnil

Last edited by Dawnnil : April 21st 17 at 05:03 AM