how to split a word document page by page 
Author Message
 how to split a word document page by page

   I need to need to split a given word document page by
page and save each document.For example a document with 10
pages need to be saved as 10 different documents.

   I know this can be done using a macro, but i dont know
where to start.Anyone can help me ?. Thanks in advance



Tue, 05 Apr 2005 14:44:43 GMT  
 how to split a word document page by page
Hi Krushna,

Try something like:

---------------------------------------------
Sub ExtractPage()
Dim i As Integer
Dim iNumPages As Integer
Dim sCurrentDoc As String

  sCurrentDoc = Activedocument.name
  'Get the current document's name
  iNumPages = Activedocument.ComputeStatistics(wdStatisticPages)
  'Get the number of pages
  For i = 1 To iNumPages
   'For as many times as there are pages
    Selection.GoTo What:=wdGoToPage, which:=wdGoToAbsolute, Count:=i
    'Goto pagenumber i
    Selection.GoTo What:=wdGoToBookmark, name:="\Page"
    'Select this page
    Selection.Copy
    'Copy the selection
    Documents.Add
    'Add a new document
    Selection.Paste
    'Paste
    Activedocument.SaveAs FileName:="newdocument" & i
    'Save the new document as "newdocument" and the value of the counter i
    Activedocument.Close
    'Close this new document
    Documents(sCurrentDoc).Activate
    'Activate the document where we started from
  Next i
End Sub
---------------------------------------------

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion, please post all follow-ups to the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/


Quote:
>    I need to need to split a given word document page by
> page and save each document.For example a document with 10
> pages need to be saved as 10 different documents.

>    I know this can be done using a macro, but i dont know
> where to start.Anyone can help me ?. Thanks in advance



Tue, 05 Apr 2005 15:06:43 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Saving page breaks from Word documents to text documents

2. Break page in a RTF document (RichTextBox New Page)

3. VBD Document 1 page loaded but second page not

4. Break page in a RTF document (RichTextBox New Page)

5. MS Word 2000 Page # Of #s Pages

6. Word not printing total number of pages in page footer correctly

7. Page of Pages To Word

8. Lock Word document pages

9. page problem in word document

10. How VBA can insert an image for each new page of a word document

11. Determining the number of pages in a document - Word 2000

12. extract document pages into word files

 

 
Powered by phpBB® Forum Software