EmersonH.Com

Transforming Knowledge into Power

  • Increase font size
  • Default font size
  • Decrease font size
Home VB 6 Word 2007 Combine Word Documents

Combine Word Documents

E-mail Print

Dim wrdApp As New Word.Application
Dim docNew As Word.Document
Set docNew = wrdApp.Documents.Add

Dim myRange As Range

'Insert a file
docNew.Range.InsertFile FileName:="C:\doc1.DOCX"

'Set the cursor at the end of file
Set myRange = docNew.Paragraphs(docNew.Paragraphs.Count).Range
'Insert Page break
myRange.InsertBreak Type:=wdPageBreak
'Insert second file
myRange.InsertFile "C:\doc2.DOCX"


'save the document
docNew.SaveAs "C:\NewFile.docX"

wrdApp.Quit

Set docNew = Nothing
Set wrdApp = Nothing

Last Updated on Monday, 21 December 2009 17:02