Word VBA >> Inserting Single word document into multiple documents

by TerryRibaudo » Wed, 06 Dec 2006 19:07:55 GMT

Hi,

Im looking to add a two page word document at the end of around 3000
CVs .Is there a way of doing this all at once? I have looked all over
the internet and all i can find is programs that will insert text into
open documents.I need to do it to a whole folder. Help is much
appreciated.

Thanks

Terry


Word VBA >> Inserting Single word document into multiple documents

by Doug Robbins - Word MVP » Wed, 06 Dec 2006 22:14:25 GMT


Modify the code in the article "Find & ReplaceAll on a batch of documents in
the same folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Similar Threads

1. How to merge several word documents to a single word document

Hi
 I have three word documents which contains different content and finally i 
want to make a single document.

for example a1.doc contains :

     This is a1 document
     some blah blah blah...

b1.doc contains :

     This is b1 document
     some blah blah blah...

c1.doc contains :

     This is c1 document
     some blah blah blah...

and finally i want to make a new document and need to copy all the text 
contained in all the documents programatically.

This is not exactly merging 

Any ideas please?

Cheers
Praveen 



2. inserting multiple entries in single document in mail merge

3. Printing multiple instances of a single document on a single page

I just typed up directions to a baby shower and want to print multiple
instances of it on a single page, perhaps eight instances of the document
per page. I will then print ten pages containing a total of eighty.

How do I print mltiple instances of this document on a single page?

Thanks.


4. Merge Word Documents As Pages Of A Single Document Using VB.NET - Word Document management

5. How do i join multiple documents into 1 single document

I have several word documents that i would like to join together to form 1 
single word document.
Is there an easy way of doing this, like in Adobe Acrobat, without having to 
copy and paste everything.
I am using Word 2007.
Thanks.

6. Creating Multiple Documents from a Single Documents - Word VBA

7. Creating Multiple Documents from a Single Document

I have an .RTF document containing a TOC and roughly 200 pages or
reports.  The TOC contains the 200 line-items (i.e. Heading 1) linking
to the 200 reports.  I have been asked to separate this one document
into 200 separate documents.  Borrowing from a macro I found searching
this group (Sub BreakOnHeading), I have been able to complete 95% of
this task.  The only thing I have left to do is to somehow give each
separate document a unique file name.  Ideally, I would like this file
name to incorporate some of the text from the TOC line-items.  The
current code, seen below, just adds a number to the name of the master
document to generate a subdocument name:

      .SaveAs FileName:=sCurrentPath & "\" & sCurrentDocStripped & i

Note:  The .RTF document was generated using SAS.  As such, each
report consists of 3 tables: a Titles/Heading table, a Data table, and
a Footnotes table.  The last row in the Titles/Heading table contains
the Heading 1-style text referenced in the TOC.

Any ideas you may have about generating more descriptive file names
would be greatly appreciated.

Thank you.

Tom 

Sub ParseClinicActivityReport()

Dim sCurrentDoc As String
Dim sCurrentDocStripped As String
Dim sCurrentPath As String
Dim i As Integer
Dim iNumBookmarks As Integer
Dim rng1 As Range
Dim rng2 As Range
Dim prng1 As Range
Dim prng2 As Range

  sCurrentDoc = ActiveDocument.Name
  sCurrentDocStripped = Left(sCurrentDoc, Len(sCurrentDoc) - 4)
  sCurrentPath = ActiveDocument.Path

  ActiveDocument.Bookmarks.DefaultSorting = wdSortByLocation
  iNumBookmarks = ActiveDocument.Bookmarks.Count

  For i = 1 To iNumBookmarks

      Set rng1 = ActiveDocument.Range.Bookmarks.Item(i).Range
     
      rng1.Select
            
      Set prng1 = ActiveDocument.Bookmarks("\Page").Range
      
      If i + 1 <= iNumBookmarks Then
        Set rng2 = ActiveDocument.Range.Bookmarks.Item(i + 1).Range
     
        rng2.Select
            
        Set prng2 = ActiveDocument.Bookmarks("\Page").Range
                             
        prng1.Start = prng1.Start + 1
        prng1.End = prng2.Start - 1
        Else: prng1.End = ActiveDocument.Range.End
      End If

        If prng1.Characters.Count > 1 Then
            prng1.Select
            Selection.Copy

            Documents.Add
            Selection.Paste
            
            With ActiveDocument
                .PageSetup.TopMargin = InchesToPoints(0.25)
                .PageSetup.LeftMargin = InchesToPoints(0.25)
                .PageSetup.BottomMargin = InchesToPoints(0.25)
                .PageSetup.RightMargin = InchesToPoints(0.25)
                .PageSetup.Gutter = InchesToPoints(0)
                .PageSetup.GutterPos = wdGutterPosLeft
                .PageSetup.Orientation = wdOrientLandscape
                .PageSetup.HeaderDistance = InchesToPoints(0.5)
                .PageSetup.FooterDistance = InchesToPoints(0.5)
                .SaveAs FileName:=sCurrentPath & "\" &
sCurrentDocStripped & i
                .Close
            End With
            Documents(sCurrentDoc).Activate
        End If

  Next i
  Selection.Collapse wdCollapseEnd
  MsgBox "Finished!", vbOKOnly

End Sub

8. macro to select multiple textblocks and insert into word document - Word VBA