Skip to content

ThirteeNov

My personal blog about coding and internet

Menu
  • About me
  • About Zofia Kreasi
  • Cart
  • Checkout
  • Making an airplane game from scratch in Unity
  • My account
  • Privacy Policy
  • Privacy Policy – zkLeaderboard
  • Sample Page
  • Shop
  • Tutorials on Learning JavaScript
  • ZKAccounts – Privacy Policy
Menu

How to make page separated Word files from a Word document

Posted on September 3, 2017August 4, 2020 by Habibie

For example I have 100 pages of a Microsoft Word document and I want to extract each page’s contents into one file (page_1.doc for first page, page_2.doc for second page and so on), so how should I do it?

Fortunately I can run a simple macros script to do it. Watch this tutorial:

Here is the script:

Sub MakeEachPageSeparated()
'
' MakeEachPageHTML Macro
'
'

   ' Used to set criteria for moving through the document by page.
   Application.Browser.Target = wdBrowsePage

   For i = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages")
      
      'Select and copy the text to the clipboard
      ActiveDocument.Bookmarks("\page").Range.Copy

      ' Open new document to paste the content of the clipboard into.
      Documents.Add
      Selection.Paste
' Removes the break that is copied at the end of the page, if any.
      Selection.TypeBackspace
      ChangeFileOpenDirectory "C:\converted"
      DocNum = DocNum + 1
      ActiveDocument.SaveAs FileName:="page_" & DocNum & ".doc", FileFormat:=wdFormatDocument, AddToRecentFiles:=True
      ActiveDocument.Close

      ' Move the selection to the next page  in the document
      Application.Browser.Next
   Next i
   ActiveDocument.Close savechanges:=wdDoNotSaveChanges

End Sub

Or try this one:

Sub NewSeparation()
    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.BuiltInDocumentProperties("Number of Pages")
    
    For idx = 1 To numPages
        ' Make sure the document is active
        orig.Activate
               
        ' 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
        Selection.Copy
        
        ' Create a new document
        Set page = Documents.Add
        
        ' Activate it
        page.Activate
               
        ' Paste the selection
        Selection.Paste
        
        ' Generate the file name
        fn = "C:\converted\page_" + CStr(idx) + ".doc"
        
        ' Save the document as Word 97-2003
        page.SaveAs FileName:=fn, FileFormat:=wdFormatDocument, AddToRecentFiles:=False
        
        ' Close the document
        page.Close
        
    Next

End Sub
Post Views: 416
ciihuy2020

Welcome!

  • My YouTube Channel
  • My GitHub Page
  • About me

Categories

  • 3DVista
  • Android
  • Apache
  • C#
  • Cordova
  • Electron & Node JS
  • HTML5, CSS & JavaScript
  • iOS
  • Let's Make Unity Games
  • Misc
  • Photoshop
  • PHP
  • Python
  • Uncategorized
  • Unity
  • WordPress

Recent Posts

  • Hover Reveal script for Unity to show and hide object on mouse hover
  • How to Prevent UI Clicks in Unity from “Bleeding Through” to 3D Objects Behind Them
  • Make objects like wires and cables easily in Unity using Ciihuy Curved Mesh
  • [SOLVED] Can’t Add Custom Domain to Blogger After Losing CNAME Verification
  • iOS App Icon Generator by CiihuyCom
© 2026 ThirteeNov | Powered by Superbs Personal Blog theme