M
Mark Holland
Hello,
I am using Word COM to automatically add some text to page 1 of a document,
then insert a TOC (Table of Contents) on Page 2.
I am struggling on how to tell it to insert the TOC at the END of the
document (As I am building it upwards). When I try and do an insert it
deletes the text I've placed on page 1.
set objword = CreateObject("Word.Application")
objword.visible = True
set objDoc = objword.Documents.Add()
set objSelection = objWord.Selection
objselection.TypeText("FIRST PAGE TEXT HERE")
objSelection.InsertBreak(7)
set myRange = objDoc.Range(0,0)
objdoc.TablesOfContents.Add myRange
Many Thanks in advance
Mark
I am using Word COM to automatically add some text to page 1 of a document,
then insert a TOC (Table of Contents) on Page 2.
I am struggling on how to tell it to insert the TOC at the END of the
document (As I am building it upwards). When I try and do an insert it
deletes the text I've placed on page 1.
set objword = CreateObject("Word.Application")
objword.visible = True
set objDoc = objword.Documents.Add()
set objSelection = objWord.Selection
objselection.TypeText("FIRST PAGE TEXT HERE")
objSelection.InsertBreak(7)
set myRange = objDoc.Range(0,0)
objdoc.TablesOfContents.Add myRange
Many Thanks in advance
Mark