Alan,
In the following code, applicationObject refers to the Word application. The
code targets the application's ActiveDocument, but you can easily modify
this to target the document referenced by myWordDoc.
The following code inserts some text at a bookmark and then reapplies the
bookmark, in case you need work with the same bookmark later on.
object oBookmarkName = "BookmarkName";
Word.Range rngRange =
applicationObject.ActiveDocument.Bookmarks.get_Ite m(ref
oBookmarkName).Range;
rngRange.Text = "Text to be inserted and bookmarked";
object oRange = rngRange;
applicationObject.ActiveDocument.Bookmarks.Add("Bo okmarkName", ref oRange);
The following code simply inserts some text at a bookmark. In the process,
the bookmark will be deleted, unless it contained no text to start with, in
which case it will still exist but the inserted text will fall after the
bookmark, not within it.
object oAnotherBookmarkName = "AnotherBookmarkName";
applicationObject.ActiveDocument.Bookmarks.get_Ite m(ref
oAnotherBookmarkName).Range.Text = "Text to be inserted";
--
Bill Coan
bi******@wordsite.com
"Alan T" <al*************@yahoo.com.auwrote in message
news:OS**************@TK2MSFTNGP02.phx.gbl...
How do I make use of the Bookmarks property so that I can write a text
at/below the position of a particular bookmark or the first bookmark ?
private Microsoft.Office.Interop.Word.Document myWordDoc = new Document();
myWordDoc.Bookmarks