Highlighting bookmark text

C

Carol Giannini

I am working on a macro that will get info from the user and insert it at a
bookmark in the document text. If the user doesn't enter info, I want to
provide reminder text for later editing (but I don't want this to appear as
default text in the input box), AND I'd like to highlight the reminder text.
Sample code is:

' Get the mailing and receipt dates from the user;
MailDate1 = InputBox(MailMsg & Doc1)

' If no user input, define and format help text
If MailDate1 = "" Then
MailDate1 = "ENTER MAILING DATE"
End If

' Go to the bookmark and enter the date
.Bookmarks("Mail1").Range _
.InsertAfter MailDate1

Is there a way to easily highlight the help text without doing a
find/replace or similar action?

Thanks much in advance. Enjoy your weekend!
 
H

Helmut Weber

Hi Carol,
as easy as this:

Dim oRng As Range
Set oRng = ActiveDocument.Bookmarks("Mark1").Range
oRng.InsertAfter "Reminder Text"
oRng.HighlightColorIndex = wdYellow

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
C

Carol Giannini

This worked perfectly. I *really* appreciate all the help I've gotten from
you and others who are way more expert than I am. Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top