View Single Post
 
Old 11-12-2021, 05:38 AM
kae0088 kae0088 is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: May 2012
Location: Melbourne, Australia
Posts: 20
kae0088 is on a distinguished road
Default Searching font names

When I look at font names they sometimes have a prefix or suffix such as “Cambria (Heading)”, “(Body) Calibri” or “(Default) Times New Roman”.

I want to search for text with specific fonts in VBA but while I can search for the font name such as Calibri but it will not find text with the font “(Body) Calibri”, nor can I find it by setting sFontName = "(Body) Calibri". How can I find these fonts
My code is:

sFontName = "Calibri"
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Text = ""
.Format = True
.Text = ""
.Font.Name = sFontName
.Execute
End With
Reply With Quote