I've just converted 10,000 documents from Lotus WordPro to MS Word 2003.
One of the problems I encountered was underlining of text in some cases.
From my code, an input textbox form prompts for the string to change. Below has the underline in between the two words and I want to remove the underline where there are spaces. It doesn't show on here but there are about 10 underlined spaces between the words.
Attribute Value
I can remove all of the underline with the code below;
With rngStory.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = strSearch
.Replacement.Text = strReplace
.Wrap = wdFindContinue
If .Replacement.Font.Underline = wdUnderlineSingle Then
'Remove underline from text
.Replacement.Font.Underline = wdUnderlineNone
End If
.Execute Replace:=wdReplaceAll
But I only want to remove it for the spaces like;
Attribute Value
How can I do this?
Thanks,
Don
Remove underline from portion of a string
-
- NewLounger
- Posts: 9
- Joined: 09 Feb 2014, 18:10
- Location: Orleans, Ontario, Canada
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Remove underline from portion of a string
Welcome to Eileen's Lounge!
Try
.Replacement.Font.Underline = wdUnderlineWords
Try
.Replacement.Font.Underline = wdUnderlineWords
Best wishes,
Hans
Hans
-
- NewLounger
- Posts: 9
- Joined: 09 Feb 2014, 18:10
- Location: Orleans, Ontario, Canada
Re: Remove underline from portion of a string
Exactly what I needed.
Thanks
Thanks