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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word - bookmark with yellow text 1

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,502
US
In Word, how do you set a bookmark so when you go to that bookmark and enter a text, the text will be highlighted in yellow color?


---- Andy

There is a great need for a sarcasm font.
 
Unless you type within the bookmarked range, you can't. Anything added immediately after it will revert to the paragraph default.

Cheers
Paul Edstein
[MS MVP - Word]
 
I just did some testing. It seems to work just fine if you create your own "goto bookmark" macro:
Code:
Selection.GoTo wdGoToBookmark, Name:="test"
Selection.Range.HighlightColorIndex = wdYellow

Cheers,
MakeItSo

"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
I tried your suggestion with this:

Code:
Selection.GoTo wdGoToBookmark, Name:="TEST"
Selection.TypeText Text:="Type this"
Selection.Range.HighlightColorIndex = wdYellow

and this

Code:
Selection.GoTo wdGoToBookmark, Name:="TEST"
Selection.Range.HighlightColorIndex = wdYellow
Selection.TypeText Text:="Type this"

But I still cannot get the typed text to be highlighted in yellow... :-(


---- Andy

There is a great need for a sarcasm font.
 
I tested it by running the macro to jump to the bookmark, then typed manually some text.
If you want to also set the text programmatically, this works just fine:
Code:
With ActiveDocument.Bookmarks("test").Range
    .Text = "This is a test"
    .HighlightColorIndex = wdYellow
End With

"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
That did the trick, than you MakeItSo :)



---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top