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!
Helmut Weber - 04 Dec 2004 09:40 GMT
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/
Carol Giannini - 06 Dec 2004 21:25 GMT
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!
> Hi Carol,
> as easy as this:
[quoted text clipped - 9 lines]
> Word XP, Win 98
> http://word.mvps.org/