Group:  Microsoft Word ยป microsoft.public.word.vba.userforms
Thread: bookmark underline

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

bookmark underline
"ted medin" <n6trf[ at ]arrl.net> 25.01.2006 00:02:56
Would like to only underline the data in the bookmark not the entire length
of the bookmark.

currently we do: .bookmark(" ... ").range.font.underline=true

then we add text to that bookmark with:
Dim Bmrange As Range
Set Bmrange = ActiveDocument.Bookmarks(strBkmk).Range
Bmrange.Text = strRep
ActiveDocument.Bookmarks.Add strBkmk, Bmrange

where strBkmk is the name of the bookmark
strRep is the text to be placed in the bookmark

wonder if something can be done with the first line to limit the range to
the length of strRep? TIA

--
MMAPHQ

WWW.MMAP.ORG


Re: bookmark underline
Cindy M -WordMVP- <C.Meister-C[ at ]hispeed.ch> 26.01.2006 19:14:26
Hi Ted,

Maybe I'm just tired, but I don't understand your question/problem. The code
you show me will replace any existing content in the bookmark, insert strRep
at the bookmark position, then recreate the bookmark around strRep. If you
then apply the underlining to Bmrange, it should only underline strRep.

What am I missing? Can you describe to us how the result you're getting
doesn't do that?

[Quoted Text]
> Would like to only underline the data in the bookmark not the entire length
> of the bookmark.
>
> currently we do: .bookmark(" ... ").range.font.underline=true
>
> then we add text to that bookmark with:
> Dim Bmrange As Range
> Set Bmrange = ActiveDocument.Bookmarks(strBkmk).Range
> Bmrange.Text = strRep
> ActiveDocument.Bookmarks.Add strBkmk, Bmrange
>
> where strBkmk is the name of the bookmark
> strRep is the text to be placed in the bookmark
>
> wonder if something can be done with the first line to limit the range to
> the length of strRep? TIA
>

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net