word automation bookmarks

  • Thread starter Thread starter andreas
  • Start date Start date
A

andreas

With a vb.net application (vb.net 2003) , I want to make a new word doc
where I put several bookmarks and also text in paragraphs following the
bookmarks
How to do?
Thanks for any response
 
First, import a reference to the Word Object Library, then create an
instance of Word:

m_WordApplication = New Word.Application
m_MainDocument =
m_WordApplication.Documents.Add(Template:=CType(m_TemplatePath, Object))
m_WordApplication.Visible = False

Then use the documented Word Object Model to navigate and manipulate the
document, including modifying the bookmarks collection and/or
inserting/editing text. A word of caution however, make sure you release
references you make to word objects, otherwise you'll find Word hanging
around in memory even after your program has terminated.
 
Thanks but I know all these things.
Wat I like to know are the real commands for inserting f.i. two bookmarks
following bij text.
Can jou write this?
 
If you know all this, then you will know that the Word object model is well
documented in Word itself (Word Visual Basic Reference). To add a bookmark:

m_Document.Bookmarks.Add (Name:="temp", Range:=m_SelectionRange)

Use the selection range of the text you have inserted and collapse it to the
end before inserting the bookmark.
 
Back
Top