+ Reply to Thread
Results 1 to 11 of 11

Split Word Docm

  1. #1
    Registered User
    Join Date
    03-03-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    39

    Split Word Docm

    I have a 208 page word document (docm) that I need to split into 104 sperate documents.
    I have tried several example macors that I found on the internet, including one's which contain delimiters, etc.
    However, none seem to work.

    Each page contains headers and footers so I cannot use cut and paste.
    Also, each page is landscape so I need when using document.add I would need to change the orientation to landscape and also the margins to narrow.

    Can anyone provide me with pointers on how to do this?

    I would have posted my progress so far on here but I haven't made any!

    Thank you.

  2. #2
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Split Word Docm

    Just so we're clear, are the 104 (exactly half of 208) new documents each only two pages long?

    Or is there some other criterion for deciding where to break your big document?

    Tony

  3. #3
    Registered User
    Join Date
    03-03-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Split Word Docm

    Yes.
    Each new document is only two pages long.

  4. #4
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Split Word Docm

    OK - take a look at this. It's only a skeleton, but if you understand this then it'll be easier to work ahead on the bits that are really important.

    Tony

    PS I needed a quick document such as the one you describe, so I used my Codelist procedure. It creates a formatted Word document of a code module in VBA, but pretty prints it with page headers, etc.

    T
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-03-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Split Word Docm

    Thank you for the reponse.
    I have tried your macro but I get a runtime error (4605) 'This method or property is not available because the object refers to a framed paragraph'.
    Is this because all of the pages contents are within tables, rather than standard paragraphs?

    It appears on the following line of the SetDocumentLayout sub:
    ' Now sset the document margins
    ActiveDocument.PageSetup.Orientation = SelectedOrientation

  6. #6
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Split Word Docm

    Hi dm,

    Could you, perhaps, post the document and code so we can get a better sense. I'd imagine that if the whole thing is tables, that you'd need a different approach!

    (BTW that's what we call an error in specifications - I probably wouldn't have sent you my example if I'd known!)

    Tony

  7. #7
    Registered User
    Join Date
    03-03-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Split Word Docm

    Here is an example of one of the two page documents.
    I have taken all of the data out.

    Thanks for your help.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Split Word Docm

    Hi dm,

    I'm wondering how this document (the 208 page one) gets created. It seems (just a hunch) that this main document could actually be a report off some other system, and if so, that's where I'd go to try and do what you want. (It's generally easier to bypass the formatting that creates a document than to try and unravel it).
    However - given what we have, let's take a stab.

    We have a pretty clear differentiation between the first page (the 7-column table) and the second page (the three summary boxes, and the two signature? lines). BTW, my copy of your example bled over onto a third page, I'm assuming that's not a common feature.

    If the structure of the first page is always going to be like this, then I'd exploit it to copy the table as a whole (or, actually, the two
    tables, because the header part is also a table, right? If the structure of the first page is going to vary then you're looking at a really knotty problem.

    So, a couple of questions:

    1) Is there any chance of getting back to an earlier point in the life-cycle of this data (ie before it becomes a word document)?
    2) Is the structure of the sub-documents always going to be like this?

    Which actually leads to a third:
    3) If there's no chance of getting at the data earlier, why don't you put in place a system to capture it, and then create 2-page documents as you wish. If all 208 pages worth are entered at one time, that might be considerably easier; and if they're not created at one sitting, then you should be able to get at the data earlier in its life-cycle.

    HTH

    Tony

  9. #9
    Registered User
    Join Date
    03-03-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Split Word Docm

    Hi Tony,
    I had an excel sheet, which pulled various bits of data from various other databases/documents.
    Using this excel sheet, a mailmerge was completed using the 'Test.docm' as a template - the 208 page document is the output of that mail merge.

    I suppose I could write a procedure to split the document per record whilst completing the mail merge????? - any ideas????

    Unfortunately I have no control of the formatting of the Test document. I cannot change this, although your correct in saying that it doesn't usually bleed over to a third page.
    The 208 page document I have (i.e. the completed mail merge) is formatted correctly but unfortunately I cannot send you this due to data it contains.

    Just an as additional point, the first page of the two page document is the only one populated with data during the mail merge, the 2nd page remains blank and is the same of all records.

  10. #10
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Split Word Docm

    I don't know how you have set up your template in Word (the document that gets filled with data over and over again), but if you think about it as a letter (pretty strange sort of letter, I know), then Word has an option to spit each one out to a separate document. (You need to be looking at Step 4 of the Mail-Merge Wizard). It sounds as though you may have created a 'Directory' (a single document).

    Try letters......

    Tony

  11. #11
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Split Word Docm

    For a generic document splitter see: http://answers.microsoft.com/en-us/o...f-3326f52ba3c4
    For a mailmerge-specific document splitter (which works on the basis of Section breaks) see: http://www.gmayor.com/individual_merge_letters.htm
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Split Word Docm
    By dm@stams in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2014, 10:37 AM
  2. Split the last word in a name
    By atdheu1100 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-13-2012, 10:59 AM
  3. how to convert excel split code to word split code
    By gsrikanth in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2012, 07:56 AM
  4. Copy Excel Range into Word, without Normal.docm save prompt
    By Graham1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-03-2011, 02:52 PM
  5. Split only last word to next cell
    By santaklawze in forum Excel General
    Replies: 2
    Last Post: 09-03-2010, 10:00 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1