O
O.B.1
Hi all,
i'm building a document generator using VB6, however
I'm not quite used to the word object model. I was
wondering if anyone can tell me how to insert a page
break at the end of the document (there are several
annexes to be added at the end, each one starting on a
new page).
This is a part of what I've got coded so far:
------------------
Set objWordApp = New Word.Application
objWordApp.Visible = True
Set objWordDoc = objWordApp.Documents.Add
("templatepath", , , True)
For intCount = 0 to objColAnnex.Count - 1
'in a loop, I would add each text from a annex classobject
'followed by a pagebreak, or first a pagebreak and then
followed by the text, whichever is the easiest.
Next intCount
---------------------
Is there anyone who could complete the code above, within
the for-next loop? I've tried to work with the
selectionobject like this:
Set sel = objWordApp.Selection
sel.MoveRight unit:=wdStory, Count:=1
sel.InsertBreak Type:=wdPageBreak
but I keep getting errormessages (bad parameter)
Thanks for your help!
Regards,
O.B.1
i'm building a document generator using VB6, however
I'm not quite used to the word object model. I was
wondering if anyone can tell me how to insert a page
break at the end of the document (there are several
annexes to be added at the end, each one starting on a
new page).
This is a part of what I've got coded so far:
------------------
Set objWordApp = New Word.Application
objWordApp.Visible = True
Set objWordDoc = objWordApp.Documents.Add
("templatepath", , , True)
For intCount = 0 to objColAnnex.Count - 1
'in a loop, I would add each text from a annex classobject
'followed by a pagebreak, or first a pagebreak and then
followed by the text, whichever is the easiest.
Next intCount
---------------------
Is there anyone who could complete the code above, within
the for-next loop? I've tried to work with the
selectionobject like this:
Set sel = objWordApp.Selection
sel.MoveRight unit:=wdStory, Count:=1
sel.InsertBreak Type:=wdPageBreak
but I keep getting errormessages (bad parameter)
Thanks for your help!
Regards,
O.B.1