Font parameters in Find/Replace in Word 2003

M

MM_B

In Word 2003, if I use the same macro that I used to use hundreds of
times in Word 2000 to find a certain character in a certain font, the
macro doesn't work. There is some sort of difference which I can see
if I look in the Find dialog box after running the macro search:
under the search box where it shows the font, it says Font: (Default)
Courier New. But if I create the search manually in the dialog box
and just select Courier New in the dialogs, then in the Find dialog
box it shows Font: Courier New [as it always used to] AND -- now the
search works! Is there any way to specify the font name *within the macro*
in Word 2003 without ending up with that "Default" bit? I've been able to use
font parameters in all other versions of Word previously.

This is in Word 2003 SP2, on Windows XP SP2. And I specify the font
name within the macro in either of these two ways but get the same
result:

right before the Find loop, either:

Selection.Find.Font.Name = "Courier New"

or With Selection.Find.Font .Name = "Courier New" End With

It seems that this problem applies only to very common fonts, especially
ones that are defaults in HTML, like Courier New, Times New Roman, and Arial
-- but these are exactly the fonts I need to distinguish between in some of
my work.

Thanks!
 
Z

zkid

Well, ain't that a kick in the pants. I played around with it for quite
awhile (it occurs in XP too, by the way). I finally punted and came up with
this solution:

Instead of Selection.Find.Font.Name = "Courier New"

try...

Selection.Find.Font.NameAscii = "Courier New"

It seemed to work for me.
 
M

MM_B

Wow, how did you come up with that? It does work!! I posted the same question
at wopr.com, and two people there said that my macro worked for them, so I'm
at a loss to explain that. But at least now I can make mine work for me.
Thanks so much for your reply.
 
Z

zkid

You're welcome. I'm so glad it worked out. I just came up with it after
playing with ranges, etc. that still didn't work. It was one of the VBA
pop-up(drop down) selections for Selection.Find.Font. I just thought, what
the heck, give it a try.... No need to respond.
 

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