I been going over a few of the posts on opening Word documents and writing to them at a Bookmark through VB.NET and I have that working OK. What I would like to do is use bold and underlining formatting (and more no doubt)
At the top of the class I have
and the main code is:Code:Private WordApp As New Word.Application
If I were to start typing at the start of the document the following works:Code:Dim fileName As Object = "C:\Proposal.doc" Dim [readOnly] As Object = False Dim isVisible As Object = True Dim missing As Object = System.Reflection.Missing.Value Dim WordDoc As New Word.Document WordApp.Visible = True WordDoc = WordApp.Documents.Open(fileName, missing, [readOnly], missing, missing, missing, missing, missing, missing, missing, missing, isVisible) WordApp.Activate() WordDoc.Bookmarks.Item("MyBookmark").Range.Text = "I am a line of text"
but I can't this working at the bookmark.Code:WordApp.Selection.Font.Bold = True WordApp.Selection.TypeText("Bold Text") WordApp.Selection.Font.Bold = False
Help much appreciated




Reply With Quote