Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6875243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:17:52+00:00 2026-05-27T04:17:52+00:00

A word document has several pages. How to split this pages into separate documents

  • 0

A word document has several pages. How to split this pages into separate documents using VB.Net ?

I wish to automate this process.

I used ms tutorial for basic learning: http://support.microsoft.com/kb/316383
But i do not know how to find page breaks in a document and move content of that page to separate document.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:17:52+00:00Added an answer on May 27, 2026 at 4:17 am

    Solution:

    Private Sub ParseWordDoc(ByVal Filename As String, ByVal NewFileName As String)
        Dim WordApp As Microsoft.Office.Interop.Word.Application = New Microsoft.Office.Interop.Word.Application()
        Dim BaseDoc As Microsoft.Office.Interop.Word.Document
        Dim DestDoc As Microsoft.Office.Interop.Word.Document
    
        Dim intNumberOfPages As Integer
        Dim intNumberOfChars As String
        Dim intPage As Integer
    
        'Word Constants
        Const wdGoToPage = 1
        Const wdStory = 6
        Const wdExtend = 1
        Const wdCharacter = 1
    
        'Show WordApp
        WordApp.ShowMe()
    
        'Load Base Document
        BaseDoc = WordApp.Documents.Open(Filename)
        BaseDoc.Repaginate()
    
        'Loop through pages
        intNumberOfPages = BaseDoc.BuiltInDocumentProperties("Number of Pages").value
        intNumberOfChars = BaseDoc.BuiltInDocumentProperties("Number of Characters").value
    
        For intPage = 1 To intNumberOfPages
            If intPage = intNumberOfPages Then
                WordApp.Selection.EndKey(wdStory)
            Else
                WordApp.Selection.GoTo(wdGoToPage, 2)
                Application.DoEvents()
    
                WordApp.Selection.MoveLeft(Unit:=wdCharacter, Count:=1)
            End If
    
            Application.DoEvents()
    
            WordApp.Selection.HomeKey(wdStory, wdExtend)
            Application.DoEvents()
    
            WordApp.Selection.Copy()
            Application.DoEvents()
    
            'Create New Document
            DestDoc = WordApp.Documents.Add
            DestDoc.Activate()
            WordApp.Selection.Paste()
            DestDoc.SaveAs(NewFileName & intPage.ToString & ".doc")
            DestDoc.Close()
            DestDoc = Nothing
    
            WordApp.Selection.GoTo(wdGoToPage, 2)
            Application.DoEvents()
    
            WordApp.Selection.HomeKey(wdStory, wdExtend)
            Application.DoEvents()
    
            WordApp.Selection.Delete()
            Application.DoEvents()
        Next
    
        BaseDoc.Close(False)
        BaseDoc = Nothing
    
        WordApp.Quit()
        WordApp = Nothing
    End Sub
    

    Credit goes to “Jay Taplin“

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone had problems inserting a PNG file into a word document, using a
My system has Office2007. And i use VB.Net to automate word. Everything works fine.
I creating a C# application that has to create a word document. I'm using
I am developing a Word 2007 document template with VSTO. The document has several
I have just written a Word Document creation web application using .NET 3.5 which
I have been given two different Microsoft Word document that my virus scanner has
I need to convert a Word document into HTML file(s) in Java. The function
When I cut and paste from a Word document into VIM, quotes get translated
How can I get my asp.net webpage to display a word document in the
I have a requirement to display word document in ASP.NET form. Also, the original

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.