how can i add a template to an existing word document?
-
quarta-feira, 23 de maio de 2012 18:49
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?
Todas as Respostas
-
quinta-feira, 24 de maio de 2012 00:11
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
- Marcado como Resposta Mark Liu-lxfModerator quinta-feira, 24 de maio de 2012 05:04
-
quinta-feira, 24 de maio de 2012 05:07Moderador
Hi Jacob,
Welcome to the MSDN forum.
Thanks for sharing the experience here. As for word issue, here is a special forum to deal with. You can post your Word issue there next time: Word for Developers: http://social.msdn.microsoft.com/Forums/en/worddev/threads
Sorry for any inconvenience and have a nice day.
Mark Liu-lxf [MSFT]
MSDN Community Support | Feedback to us

