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 / November 2004

Tip: Looking for answers? Try searching our database.

Font size is changed when runnning search

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave Neve - 12 Nov 2004 10:32 GMT
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
Helmut Weber - 12 Nov 2004 15:05 GMT
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/
 
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.