How to go to a particular position in a document.....

S

Sandeep

Hi,

I am trying to insert a sub document in another document.
I am using document.AddFromFile(...) function for that.
By default it inserts the subdocument at the beginning. I
want that it should be inserted at a particular position
say, between 2nd and 3rd paragraph, or at a particular
bookmark position.
I dont get how to achieve the same.

Pls help.
Thx.
Sandeep
 
M

macropod

If you set a bookmark at the required insertion point, you can have your
code find it and insert the other document at that point (see sample code
below, in which both the bookmark name and the replacement text are
specified as calling parameters).

Cheers

Sub UpdateBookmark (sBookmark as string, sValue as string)
Dim oRange as Range
If Documents.Count > 0 then
If ActiveDocument.Bookmarks.Exist (sBookmark) then
Set oRange =
ActiveDocument.Bookmarks(sBookmark).Range
oRange.Text = sValue
ActiveDocuments.Bookmarks.Add sBookmark, oRange
End if
End if
Set oRange = Nothing
End sub
 

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