Find Arial?

H

Helmut Weber

Hi everybody,

starting with the question from Tony Logan
"stop selection when finding certain font"
I thought, I could come up with a simple solution.

However, when searching for "Arial",
nothing is found.
Works well with "Arial Black" or "Arial Narrow"?

Any ideas?

Sub test7568()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
ResetSearch
With rDcm.Find
.Text = ""
.Font.Name = "Arial" ' no way
'.Font.Name = "Arial Narrow" ' alright
'.Font.Name = "Arial Black" ' alright
.Format = True
While .Execute
rDcm.Select
Wend
End With
ResetSearch
End Sub
'----
Public 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
' plus some more if needed
.Execute
End With
End Sub


Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
J

Jean-Guy Marcil

Helmut Weber was telling us:
Helmut Weber nous racontait que :
Hi everybody,

starting with the question from Tony Logan
"stop selection when finding certain font"
I thought, I could come up with a simple solution.

However, when searching for "Arial",
nothing is found.
Works well with "Arial Black" or "Arial Narrow"?

Any ideas?

There is something wrong with your fonts? ;-)

Your code worked as expected on my machine.
Are you sure you have Arial and that it is actually called Arial, and not
"MS Arial", or "Arial ".... you never know, I wouldn't trust that German
engineering!

Just kidding! Give me an average German car over almost any North American
car any day!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
H

Helmut Weber

Hi Jean-Guy,

hm..., I wonder.

The text in Arial is bold,
which causes no trouble in Word 97
using either the dialog or the macro.

Not so in 2002 and 2003.
While searching for Arial via dialog still works,
even if the text is bold,
the macro does not find Arial, if bolded.

Everything is fine with Times New Roman.

Some more info: When starting Word 2002,
having used Word 97 before, I get a couple
of messages, that fonts could not be registered.
Impossible to find out, which fonts.
Though I don't think it's Arial.

Error number is 1907. I ignore the messages, and
everything is fine except the problem described here,
which occurs on both of my quite differently configurated PCs.

BTW, lately someone asked what "Bavaria" was...

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

Jean-Guy Marcil

Helmut Weber was telling us:
Helmut Weber nous racontait que :
Hi Jean-Guy,

hm..., I wonder.

The text in Arial is bold,
which causes no trouble in Word 97
using either the dialog or the macro.

Not so in 2002 and 2003.
While searching for Arial via dialog still works,
even if the text is bold,
the macro does not find Arial, if bolded.

I am running Word 2003 SP1, and your macro still works, regardless of the
font attributes applied on Arial text (Bold, Italic, Underlined, or any
combinations thereof).
Everything is fine with Times New Roman.

Some more info: When starting Word 2002,
having used Word 97 before, I get a couple
of messages, that fonts could not be registered.
Impossible to find out, which fonts.
Though I don't think it's Arial.

Error number is 1907. I ignore the messages, and
everything is fine except the problem described here,
which occurs on both of my quite differently configurated PCs.

Are you using a localized version of Word?
BTW, lately someone asked what "Bavaria" was...

??? Everybody knows it's a beer company!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
H

Helmut Weber

Hi Jean-Guy,
Are you using a localized version of Word?

one is localized, one is US-English, from the MSDN CDs.

Thanks for thinking.


Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
J

Jean-Guy Marcil

Helmut Weber was telling us:
Helmut Weber nous racontait que :
Hi Jean-Guy,


one is localized, one is US-English, from the MSDN CDs.

Aren't font installed by Windows?
Maybe there is something wrong with your Windows version?


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
K

Klaus Linke

Also: Have you looked in "Tools > Options > Compatibility > Font
substitution" for anything fishy?
If you want to, you can mail me a sample doc (in case it's something about
your documents rather than your system).

I've had a lot of similar (but probably different) problems in Word2003
lately:
Word applies Far East fonts or large Unicode fonts (say MS Mincho, Lucida
Unicode, Batang, ...) to certain "exotic" characters (say some IPA
phonetics, or spacing characters, ...). It also changed the language to some
Asian language at the same time.
Changing the language back to a Western language sometimes fixed the font,
too, but not always.

And searching for those fonts didn't find the text allegedly formatted in
them.
Only after I installed support for some Asian language (I chose Chinese),
the "Edit > Find > Font" dialog now has an additional field for the Far East
font.

Word seems to be able to define several different fonts for the same text,
and chooses the actual font depending on the language, and probably
depending on whether it thinks the character will be available from the font
defined by the user/style (which it often seems to get wrong).

I doubt that this is the problem in your case, but you might try to select
some text in "Arial Bold" that you can't find, and check
? Selection.Font.Name
? Selection.Font.NameAscii
? Selection.Font.NameBi
? Selection.Font.NameFarEast
? Selection.Font.NameOther

If the latter show different fonts, that is normal. But the first two should
yield "Arial Bold", I think. And you could check in Tools > Language if Word
has applied some strange language to the text.

Regards,
Klaus
 
H

Helmut Weber

Hi Klaus, hi Jean-Guy, and all co-readers,
dear Cindy, who answered to the same question in the German groups,

thank you.

Don't waste too much time on it.
It's not a problem, just a mystery.

Let me summarize:

Phenomenon occurs

- on at least two machines,
first, Win 2000 + Word 2002,
set up last year, German versions,
- second, Win XP + Word 2003, set up some weeks ago,
US-versions,
- in all documents, all very small, just a few lines of text,
- only when searching by macro (range or selection),
- not when searching by dialog,
- not in Excel.


- there are no font substitutions
- there is no fancy software
- Selection.Font.Name is "Arial"
- Selection.Font.NameAscii is "Arial"

The newer machine is almost entirely reserved for testing Office.
There isn't even a printer or a virus scanner.

Good day to you all.


Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
K

Klaus Linke

Hi Helmut,

It does seem to be a problem similar to those I've run into lately.

Does
Selection.Find.Font.NameAscii="Arial"
maybe work better than
Selection.Find.Font.Name="Arial"
?

It's a pretty mess. I've tried to find some Asian font, MS Mincho, today.

Searching for
Selection.Find.Font.NameFarEast = "MS Mincho"
picked up most of the texts in regular Western fonts (Arial, ...),
Selection.Find.Font.Name = "MS Mincho"
didn't find anything, but
Selection.Find.Font.NameAscii = "MS Mincho"
seemed to work.

To be on the safe side, I looked for the font *and the language*, but still
hope that maybe using NameAscii might do the trick reliably.

Regards,
Klaus
 
H

Helmut Weber

Hi Klaus,

"...font.name.ascii" did the trick.

Congratulations.

So why not always using "font.name.ascii"?

Any drawbacks?

Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
K

Klaus Linke

Hi Helmut,
"...font.nameascii" did the trick.
Great!!!

Congratulations.

So why not always using "font.nameascii"?

Any drawbacks?

I'm not 100% happy using badly documented stuff that I can't completely
understand.
But if it works, I'll use .NameAscii instead of .Name, too.

Regards,
Klaus
 

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