MSOffice Programming (Word) help

  • Thread starter Thread starter steven chong
  • Start date Start date
S

steven chong

Hi everyone,
Hope the MVPs for Office can help me out here.
Programming the word object is new to me. Basically, what i need to do is...
1) Open a template word document.
2) Menu->Insert->File (Another word Document)
3) Page Break
4) Repeat Step 2 for another file
5) Page Break
6) Save

i was succesfully in Inserting the new WordFile, but cant page break and
insert the next file. i always only get the latest file which i inserted
as the final product.
any samples, links which i can refer to will be very helpful

what i have now:

objWord = New Word.Application()
objWord.Documents.Open("C:\before.doc")
objWordDocument = objWord.ActiveDocument
With objWordDocument
.Range.InsertFile("C:\Word\Blah\File1.doc")
.Range.MoveEnd()
.Range.Collapse(0)
.Range.InsertBreak(7)
.Range.InsertFile("C:\Word\Blah\File2.doc")
.SaveAs("C:\after.doc")
End With

thanks in advance
 
Back
Top