Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I format a bookmark?

Status
Not open for further replies.

marcello62

Technical User
Jun 19, 2006
42
NL
Hi there,

I fill a word document from a ms access vba code module using bookmarks.
Now I want some bookmarks to be represented in a color, say green.
I fill the bookmark:
doc.Bookmarks("b1718_1").Range.Text = doc.Bookmarks("b1718_1").Range.Text = Format(rs!mv5_1_10p, "0.0")
This works.
Then I tried:
doc.Bookmarks("b1718_1").Range.HighlightColorIndex = wdBrightGreen
This works, but it makes the whole bookmark green. So the value is put in a green square.
But what I want is the value itself, which is a figure, in green.
I did some research on the internet and found that the following code should work:
doc.Bookmarks("b1718_1").Range.Text = doc.Bookmarks("b1718_1").Range.Text = Format(rs!mv5_1_10p, "0.0")
doc.Bookmarks("b1718_1").Range.Font.ColorIndex = wdBrightGreen
The code compiles, but the value still had forecolor black...

Does anyone know what might help? Any help will be greatly appreciated, thanx
 
This worked! Apparently the tric was to select the bookmark before manipulating it's font.
Thanx very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top