Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
I am new to VB so be nice
![]() I am trying to merge a number of word documents together, and am trying to use the master/subdocument concept. However, the documents are appearing at the top of the master document, instead of being added sequentially at the end of the document (which is what I want). I have a template document which I wish to append these subdocuments to. This template will contain a cover sheet, table of contents, styles, headers/footers, etc etc. The code I have is Dim oDoc As Word.Document Dim oPara As Word.Paragraph oPara = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\ endofdoc").Range) oPara.Range.Text = "Heading 1" oPara.Range.InsertParagraphAfter() oDoc.Application.ActiveDocument.Subdocuments.AddFr omFile("c: \document1.doc") oPara = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\ endofdoc").Range) oPara.Range.Text = "Heading 2" oPara.Range.InsertParagraphAfter() oDoc.Application.ActiveDocument.Subdocuments.AddFr omFile("c: \document2.doc") However, the document generated looks like c:\document1.doc ------ these are the hyperlinks to the subdocuments c:\document2.doc Template document stuff Heading 1 Heading 2 I have tried making use of the endofdoc bookmark to try to get the subdocuments at the end using the following: oDoc.Application.ActiveDocument.Subdocuments.Expan ded = True oDoc.Application.Selection.InsertParagraphAfter() oDoc.Bookmarks.Item("\endofdoc").Range.Subdocument s.AddFromFile(vReports(vCount)) but this doesn't help either. Can anyone please help me? Thanks Martin |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
I've got it resolved now. I added the following:
oDoc.Application.Selection.EndKey(Word.WdUnits.wdS tory) oDoc.Application.ActiveDocument.Subdocuments.AddFr omFile("c: \document1.doc") This moves to the last page and adds the subdocument. |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
combining documents | Microsoft Word Help | |||
combining seperate word documents into one | Microsoft Word Help | |||
Combining Documents | Microsoft Word Help | |||
Combining 5 documents to one | Microsoft Word Help | |||
Combining two Word documents | Microsoft Word Help |