I am trying to use the find object to find text matching format of
other text.

I thought I could do that just by (for example)

selection.find.font = activedocument.range(12,13).font

This does not find anything. It does not find the characters I used as
a basis for identifying the font to search for.

With Selection.Find
.ClearFormatting
.Font = ActiveDocument.Range(12, 13).Font
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.CorrectHangulEndings = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
.Execute
If Not .Found Then
MsgBox "Find fails"
End If
End With

On the other hand, if I set selection.find.font.bold = true, or
something of the kind, it will find bolded text.

Is it possible to just set a font on the find object from some other
font object, and then search for matching formats?

Cheers -- Chris

RE: find matching format by HelmutWeber

HelmutWeber
Thu Jan 24 04:52:01 PST 2008

Hi Duas,

IMHO, you can only search for specific font.properties,
not for something that matches a font.object in all details.

However, the following might help:

Sub Macro33ab()
Dim rTmp As Range
Set rTmp = Selection.Range
Dim oFnt As Font
Set oFnt = Selection.Range.Font
rTmp.Collapse direction:=wdCollapseEnd
With rTmp.Find
.Font.Bold = oFnt.Bold
.Font.Name = oFnt.Name
.Font.Color = oFnt.Color
If .Execute Then
rTmp.Select
End If
End With
End Sub


--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000 (german versions)



Re: find matching format by Duas

Duas
Mon Jan 28 00:08:15 PST 2008

Thanks very much! -- Chris