jcgldr 0 Newbie Poster

i'm working with vb to automate word documents

so to create a new document i use

dim oword as word.application

dim odoc as word.documant

odoc=oword.documents.add

and to open a document i use

odoc=oword.document.add(mypath+mytemplate)

but i'm struggling now how to add a template to an existing document for example i want to print 5 invoices on the same document so i open word and add the first template

like this
odoc=oword.document.add(mypath+mytemplate)
and at the second invoice i want it not to open a seperate document can someone help me?

i found a solution i used the folowing code

oWord.ActiveDocument.Characters.Last.Select()
oWord.Selection.InsertBreak(word.WdBreakType.wdPageBreak)
oWord.Selection.InsertFile(Application.StartupPath + "\shulltamp.dotx")

but the problem with that is that even though the teplate is inserted but i can not reffer to the bookmarks of the template becuase it refers to the first template all the time

so i would like to know if there is a posiblity to delete bookmarks from a doc ? or any other solution

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.