InsertFile problem

J

JensB

Hi Ng
I have a vb.net App inserting 5-6 smaller word documents into the middle of
a WORD template by this:
..GoTo(What:=wdGoToBookmark, Name:="Start")
..Selection.Range.InsertFile("C:\hcn.doc") '.1...2...3

My problem is that insert point remain the same, so the first text becomes
the last.
so my question is:
Hows do I get the cursor to placed after the newly inserted text?

this command dosen't help
..Selection.Range.Collapse(Direction:=wdCollapseEnd)

\JensB
 
S

Stefan Blom

Using a Range variable should work. Just to be safe, you even use a
duplicate of the original Selection.Range object. For example:

Dim r As Range
Set r = Selection.Range.Duplicate
r.Collapse wdCollapseEnd
'then insert the file...

Note that you probably don't need the Selection at all, since you can
work directly with the Range object defined by each bookmark.

--
Stefan Blom
Microsoft Word MVP


in message news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top