Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jun 2003
    Location
    Utah, USA
    Posts
    412
    Thanks
    39
    Thanked 5 Times in 5 Posts

    Split and Save On Page Breaks (2007 SP1)

    I have a 75 page file that I'd like to save into 75 one page files.

    Is there a way to get Word to save everything between two hard page breaks to a file, and then move to the next section, and so on?

    If there's nothing automatic, I'd be willing to do it with a macro, but I'm not sure how to get it to find the page breaks.

  2. #2
    4 Star Lounger
    Join Date
    Jun 2003
    Location
    Utah, USA
    Posts
    412
    Thanks
    39
    Thanked 5 Times in 5 Posts

    Re: Split and Save On Page Breaks (2007 SP1)

    Extremely cool: one typo though, it needs a single quote in front of the line "Find All Instances" since it is a comment.

    FYI: Yes, my file does have 75 or so hard page breaks. I have a semester long lecture divided into topics that take 20-30 minutes each. They all go on one page, so that the page I have open on the lectern for reference has everything I need on one page. For a 50 minute class I do 2 pages per day, for a 75 minute class I do 3 per day, and for a 150 minute class I do 6 pages.

    FWIW: I need to break it into pieces for posting online for students.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Split and Save On Page Breaks (2007 SP1)

    Sorry about the typo, I added the comments at the last moment and didn't check carefully enough.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Split and Save On Page Breaks (2007 SP1)

    Edited by HansV to correct mistake

    You really have 74 hard page breaks in the document? <img src=/S/yikes.gif border=0 alt=yikes width=15 height=15>

    As far as I know, there is no built-in method to split a document on soft or hard page breaks. Here is a macro that will split a document at hard page breaks:

    Sub SplitPages()
    Dim docCur As Document
    Dim docNew As Document
    Dim n As Integer
    Dim lngNew As Long
    Dim lngOld As Long
    Set docCur = ActiveDocument
    ' Move to start
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
    ' Set up search criteria
    .ClearFormatting
    ' Code for hard page break
    .Text = "^m"
    .Wrap = wdFindStop
    .Forward = True
    ' Find all instances
    Do While .Execute
    n = n + 1
    lngOld = lngNew
    lngNew = Selection.Start
    ' Copy range
    docCur.Range(Start:=lngOld + 1, End:=lngNew - 1).Copy
    ' Create new document
    Set docNew = Documents.Add
    ' Paste
    docNew.Content.Paste
    ' Save, then close new document
    ' You can add a path here and change the name as desired
    docNew.SaveAs FileName:="Part" & n & ".doc"
    docNew.Close SaveChanges:=False
    Loop
    End With
    ' Last part
    n = n + 1
    lngNew = docCur.Content.End
    ' Copy range
    docCur.Range(Start:=lngOld + 1, End:=lngNew - 1).Copy
    ' Create new document
    Set docNew = Documents.Add
    ' Paste
    docNew.Content.Paste
    ' Save, then close new document
    docNew.SaveAs FileName:="Part" & n & ".doc"
    docNew.Close SaveChanges:=False
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •