H
Henrik
Hi I'm new to Word Automation and would need some help
I have a template with bookmarks I would like to append several times
to my main document.
Here is what i try to do, question is in "Do... Loop" statement.
Dim oWordApp As New Word.ApplicationClass
Dim oMainDoc As Word.DocumentClass
Dim oTemplate As Word.DocumentClass
oMainDoc = oWordApp.Documents.Add()
oTemplate = oWordApp.Documents.Add("c:\\test\\template.dot")
oMainDoc.Activate()
Do
' First I update the bookmarks on my oTemplate
' Then I want to append it's complete content to oMainDoc
' But how do I do that???
' I know I could save oTemplate to a temp document
' and then use
' oWordApp.Selection.InsertFile("temp_document_fullpath")
' But think there must be a better way of doing it
' If I only wanted the text in the template I could
' use
' oWordApp.Selection.TypeText(oTemplate.Content.Text())
' But I want it complete with all styles, tables and stuff
Loop While foo = 1
Thanks in advance,
Henrik
I have a template with bookmarks I would like to append several times
to my main document.
Here is what i try to do, question is in "Do... Loop" statement.
Dim oWordApp As New Word.ApplicationClass
Dim oMainDoc As Word.DocumentClass
Dim oTemplate As Word.DocumentClass
oMainDoc = oWordApp.Documents.Add()
oTemplate = oWordApp.Documents.Add("c:\\test\\template.dot")
oMainDoc.Activate()
Do
' First I update the bookmarks on my oTemplate
' Then I want to append it's complete content to oMainDoc
' But how do I do that???
' I know I could save oTemplate to a temp document
' and then use
' oWordApp.Selection.InsertFile("temp_document_fullpath")
' But think there must be a better way of doing it
' If I only wanted the text in the template I could
' use
' oWordApp.Selection.TypeText(oTemplate.Content.Text())
' But I want it complete with all styles, tables and stuff
Loop While foo = 1
Thanks in advance,
Henrik