Results 1 to 4 of 4
  1. #1
    3 Star Lounger siflaar's Avatar
    Join Date
    Jan 2001
    Location
    Amersfoort, Netherlands
    Posts
    203
    Thanks
    4
    Thanked 0 Times in 0 Posts

    copy of masterdocument including all subdocuments

    Hello,
    I am creating some VBA code to strip selected parts of a Word document.
    But the document I am working with is a master document.
    What code do I use to save a copy of the master document with all subdocuments included (so no connections to the subdocuments anymore = no master document)

    Thanks in advance for your reactions.

    Patrick Schouten
    The Netherlands
    Last edited by siflaar; 2011-04-18 at 09:04. Reason: typos

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

    Before you go any further, read: http://www.word.mvps.org/FAQs/AppErrors/CorruptDoc.htm and http://word.mvps.org/FAQs/General/Wh...ocsCorrupt.htm

    To merge the docments, you could try something along the lines of:
    Code:
    Sub MergeDocs()
    With ActiveDocument.Subdocuments
      If .Count > 0 Then
        .Merge FirstSubdocument:=1, _
        LastSubdocument:=.Count
      End If
    End With
    End Sub
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. The Following 2 Users Say Thank You to macropod For This Useful Post:

    RetiredGeek (2011-04-19),siflaar (2011-04-21)

  4. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Paul's code appears to join the separate subdocs into a single one but this version should embed all subdocs
    Code:
    Sub MergeDocs()
      With ActiveDocument.Subdocuments
        While .Count > 0
          .Item(1).Delete
        Wend
      End With
    End Sub
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    siflaar (2011-04-21)

  6. #4
    3 Star Lounger siflaar's Avatar
    Join Date
    Jan 2001
    Location
    Amersfoort, Netherlands
    Posts
    203
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Paul and Andrew,
    Thank you both for your quick respones.
    This code will get me further.

    Greetings,
    Patrick Schouten
    The Netherlands

Tags for this Thread

Posting Permissions

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