Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

Highlighting bookmark text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carol Giannini - 04 Dec 2004 03:25 GMT
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/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.