Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Macro Needed to Break Up long MS Word 2010 Document into small docs.

    Hello,

    I have a long MS Word 2010 document several hundred pages in length.
    The document was extracted from a PDF. The results were good, but now
    I need a Macro to break the long document apartment into separate files.
    Is this possible based on some keyword at the end of each chapter (e.g. END OF SECTION)
    or will I have to do it all manually? It would be nice if a macro could do the job.

    Thanks in advance for any suggestions.

    Regards,

    -J

  2. #2
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hello again,
    I found a link on the web to an article titled:

    "Is there an application that can automatically split a large word document into several small ones."

    http://www.proz.com/forum/office_app...mall_ones.html

    The website is informative with some macro code, but I need to have my long book split when it finds "END OF SECTION" in each Chapter. With that said, does any one have any suggestions or know of a document splitter that can split after keywords? Thanks again for any suggestions. Regards, -J

  3. #3
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Here is the macro referenced on the site (see below). Again, I would like to be able to find repeating key words at the end of each section and then break the document up into a file right after that. Here is some code from that website:

    http://www.proz.com/forum/office_app...mall_ones.html
    Code:
    origdoc = ActiveDocument.Name
    Dim Mldg, Titel, Voreinstellung, Batches
    Mldg = "Number of batches?"
    Titel = "Freeware by www.ecm-e.de, W. Polmann."
    Voreinstellung = "1" ' Voreinstellung festlegen.
    ' Meldung, Titel und Standardwert anzeigen.
    Batches = InputBox(Mldg, Titel, Voreinstellung)
    Prozentsprung = 100 / Batches
    For x = 1 To Batches
        ActiveDocument.SaveAs FileName:="Teil_" & x & "_" & origdoc & ".doc", _
        FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _
        AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
        EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
        :=False, SaveAsAOCELetter:=False
        EndeProzentsprung = Prozentsprung * x
        AnfangProzentsprung = EndeProzentsprung - Prozentsprung
        Selection.GoTo What:=wdGoToPercent, Which:=wdGoToNext, Count:=AnfangProzentsprung, Name:=""
        Anfang = Selection.Start
        Selection.GoTo What:=wdGoToPercent, Which:=wdGoToNext, Count:=EndeProzentsprung, Name:=""
         ' Bis zur nächsten Absatzmarke hoch
        Selection.Find.ClearFormatting
        With Selection.Find
            .text = "^p"
            .Replacement.text = ""
            .Forward = True
            .Wrap = wdFindAsk
            .Format = False
            .MatchCase = False
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
        End With
        Selection.Find.Execute
        Selection.MoveRight Unit:=wdCharacter, Count:=1
        Ende = Selection.End
        Set Range = ActiveDocument.Range(Anfang, Ende)
        Range.Select
        Selection.Copy
        Selection.WholeStory
        Selection.Delete Unit:=wdCharacter, Count:=1
        Selection.Paste
        ActiveDocument.Save
        ActiveDocument.Close
        Documents.Open FileName:=origdoc, _
        ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
        PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
        wdOpenFormatAuto
    Next x
    ActiveDocument.Close
    End Sub
    Last edited by macropod; 2012-02-27 at 01:33. Reason: Added code tags & structure

  4. #4
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Atlanta
    Posts
    568
    Thanks
    7
    Thanked 1 Time in 1 Post
    You can do this with a macro but if you have to write and debug it yourself, it will take longer than doing this manually. Just make five (or however many) copies of the document and manually search for the text. You can easily clip each document to contain only one section.


    Ronny
    Ronny Richardson

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. The Following User Says Thank You to macropod For This Useful Post:

    jamesm067 (2012-03-10)

Posting Permissions

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