I'm writing a document generator with vb.net and Word automation. I've found some info on the net, and I can succesfully modify bookmark values to create a fresh document, like so:
Dim oWordDoc As Word.Document = oWordApp.Documents.Open(fileName, missing, oReadOnly, missing, missing, missing, missing, missing, missing, missing, missing, isVisible)
Dim oBookmark As Object = myBookmarkName
oWordDoc.Bookmarks.Item(oBookmark).Range.Text = myText
However, it doesn't work when I try to change the formatting of this bookmark, to bold, italic or underlined, like so:
oWordDoc.Bookmarks.Item(oBookmark).Range.Font.Bold = True
I've tried replacing 'True' with '1', but it doesn't add any formatting changes to the open word document.
I've also tried grabbing the range first, but that doesn't work either:
Dim oRng As Word.Range = oWordDoc.Bookmarks.Item(oBookmark).Range
oRng.Font.Bold = True
The range object also has Bold, Italic, and Underline properties, but I haven't had any succes with those either. Oh, and I've tried setting the text value before and after the formatting change, but that doesn't seem to be the problem either.