A
A Kabak
I need to insert a word doc at a dynamically discovered
position within another word doc at runtime. I'm using
VB.NET to try to do this. In the base doc, I've got a
bookmark that shows where these inserted files should
start. I want to set my cursor one space after the end of
the bookmark and insert another file at that point, but
I'm having problems. I've tried lots of different ways to
do this; some of them are listed below:
'get the character position at the end of the bookmark
intStart = WordDoc.Bookmarks.Item(strBookmark).End
WordDoc.Range.SetRange(intStart, intStart + 1)
WordDoc.Range.Select()
WordDoc.Range.InsertFile "D:\Topeka\Output\BESubreportTest.
doc")
or
WordDoc.Characters.Item(intStart + 1).Select()
WordDoc.Application.Selection.InsertFile
("D:\Topeka\Output\BESubreportTest.doc")
Neither seems to work. In fact the first one selects the
entire document as the range so that when I run the
insert, it replaces the document with the inserted file.
Any ideas?
position within another word doc at runtime. I'm using
VB.NET to try to do this. In the base doc, I've got a
bookmark that shows where these inserted files should
start. I want to set my cursor one space after the end of
the bookmark and insert another file at that point, but
I'm having problems. I've tried lots of different ways to
do this; some of them are listed below:
'get the character position at the end of the bookmark
intStart = WordDoc.Bookmarks.Item(strBookmark).End
WordDoc.Range.SetRange(intStart, intStart + 1)
WordDoc.Range.Select()
WordDoc.Range.InsertFile "D:\Topeka\Output\BESubreportTest.
doc")
or
WordDoc.Characters.Item(intStart + 1).Select()
WordDoc.Application.Selection.InsertFile
("D:\Topeka\Output\BESubreportTest.doc")
Neither seems to work. In fact the first one selects the
entire document as the range so that when I run the
insert, it replaces the document with the inserted file.
Any ideas?