Font size is changed when runnning search

D

Dave Neve

Hi

I have words in a table which reflect the tones of a foreign language

eg thee (falling tone)

But this special format is changed and becomes


thee (flat tone)


when I do a word search using the following two macros.

As I can't see a line for font, I wonder which line is causing the font size
to change and can I take it out without any other side effects.

Thanks in advance



Sub Highlight()
Dim sSrc As String
Options.DefaultHighlightColorIndex = wdYellow
sSrc = Selection.Text
Resetsearch
Selection.SelectColumn
With Selection.Find
.Text = sSrc
.Replacement.Text = sSrc
.Replacement.Highlight = True
.MatchWholeWord = False ' or true if you like
.Wrap = wdFindStop ' !!!
.Execute Replace:=wdReplaceAll
End With
Resetsearch
End Sub

Sub Resetsearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub
 
H

Helmut Weber

Hi Dave,
hm...
all I can say is, it works perfectly here now now.
Is there more in your code then you have posted?
Here is an alternative, using wildcard search:
Sub Highlight()
Dim sSrc As String
Options.DefaultHighlightColorIndex = wdyellow
sSrc = Selection.Text
Resetsearch
Selection.SelectColumn
With Selection.Find
.Text = sSrc
.Replacement.Text = "^&" ' difference 1
.Replacement.Highlight = True
.MatchWholeWord = False ' or true if you like
.MatchWildcards = True ' difference 2
.Wrap = wdFindStop ' !!!
.Execute Replace:=wdReplaceAll
End With
Resetsearch
End Sub
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 

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