Problem with finding font

P

pavon

I want to use find and replace to find characters in a
paragraph which have same font with the first character
and adjacent to the first character.for example,
one paragraph:"abcd",fonts of 'a' and 'b' are completely
same,including font name,font size,font color,bold or
not,italic or not.
but fonts of 'b' and 'c' are different.so the expected
output of my program is "ab".and my program really works
when meeting english characters,but it doesn't work with
chinese characters,even i set the find.LanguageID =
wdSimplifiedChinese

here is the source code of my program
With R.Find
.ClearFormatting
.Font.color = R.Characters(1).Font.color
.Font.name = R.Characters(1).Font.name
.Font.Bold = R.Characters(1).Font.Bold
.Font.Italic = R.Characters(1).Font.Italic
.Font.Size = R.Characters(1).Font.Size
.text = ""
.Replacement.text = ""
.MatchCase = False
.MatchWildcards = False
.MatchWholeWord = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Wrap = wdFindStop
.Format = True
.Forward = True
If (.Execute = True) Then
Debug.Print "Find!!!"
End If
End With
Debug.Print R.text
could anybody tell me what's wrong with my program,or
there are some bugs with the "Find and Replace",thanks a
lot!
 
P

pavon

and i think problem may lie here
.Font.name = R.Characters(1).Font.name
when i debug my program step by step,even the R.Characters
(1).Font.name is not empty(such as "Arial"),but after
execution of assignment,the value of R.Find.Font.name is
still empty ("").It seems so odd,and i don't know
why,because property "name" of "Font" is read/write,not
read-only.and giving such an assignment like "R.Font.name
= "Arial" ",it will execute normally.
 

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