• Font search parameters in Word 2003 (Word 2003 SP

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Font search parameters in Word 2003 (Word 2003 SP

    Author
    Topic
    #444164

    In Word 2003, if I use the same macro that I used to use hundreds of
    times in Word 2000 to find text 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 have
    always been able to use font parameters in searches in previous versions of Word.

    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

    The problem appears to be limited to very common fonts, like Courier New,
    Times New Roman, and Arial (default fonts in HTML). But in my work sometimes
    these are exactly the fonts in which I need to find something.

    Thanks!

    Viewing 1 reply thread
    Author
    Replies
    • #1073376

      Welcome to Woody’s Lounge!

      Just a guess: does it make a difference if you clear the check box “Keep track of formatting” in the Edit tab of Tools | Options?

      • #1073377

        Hi Hans,

        That does not make a difference. Thanks, though!

        • #1073378

          Would it be possible to attach a small document with the macro and some text that demonstrates the problem? You can replace sensitive or proprietary text with dummy text. That would enable others to investigate the problem directly.

          • #1073386

            You wouldn’t even need any special text. Run this macro in any document. Then, open the Find dialog box and you’ll see the “[Default]” thing I”m talking about. The macro looks for any letter character in the Courier New font. But, if you change the font in the macro to something more unusual, like Castellar or Palatino, it will work (you’d have to have that font in the document, of course), and you won’t see the “[Default]” indicator:

            Sub TestFindFont
            Selection.Find.ClearFormatting
            Selection.Find.Replacement.ClearFormatting
            Selection.Find.Font.Name = “Courier New”
            With Selection.Find
            .Text = “[a-z]”
            .Forward = True
            .Wrap = wdFindContinue
            .Format = True
            .MatchCase = False
            .MatchWholeWord = False
            .MatchWildcards = True
            .MatchSoundsLike = False
            .MatchAllWordForms = False
            End With
            Selection.Find.Execute
            End Sub

            • #1073389

              OK. The code works as expected (without [Default]) in Word 2002. If nobody else replies in the meantime, I’ll test it tomorrow morning (European time) on a PC with Word 2003.

            • #1073390

              This code successfully finds text with the Courier New font for me on Word 2003 SR2, but it does display (default) in the dialog box, as you describe.

              StuartR

            • #1073395

              well, that’s an interesting wrinkle. I wonder what’s different between our systems — so far I’ve asked five different groups/mailing lists, etc., and you are the first person for whom this works.

            • #1073430

              I’ve tested the code in Word 2003 now, and
              a) it does find text formatted with Courier New
              the dialog does display (Default) Courier New afterwards.
              See screenshot.
              Note that the code only finds lower case letters, since searching with wildcards is always case-sensitive. If you want to find both uppercase and lowercase letters, you should search for [a-zA-Z]

            • #1073505

              Hi Hans,
              In the original macro, I was not searching on wildcards. I changed it to use wildcards just for demo purposes since I didn’t know what would be in your file. It’s not the wildcards that create the problem. OK, so it’s obviously possible for the search to work since it works for you, but I don’t know where to look to find the problem, since you two in this forum are the only people who have said it works for them (I’ve asked DailyWordTips, Word-PC, and Jack Lyon, plus one more source that hasn’t responded.) When I try it, the search will not work in Courier New, Times New Roman, or Arial, but it will work with a less common font, like Castellar. What could be different for you than for all the rest of us?

              Thanks,
              Margaret

            • #1073521

              I use a plain vanilla Word 2003 installation at work, so I don’t think my situation is special.

              Try Phil Rabichow’s Systematic Approach to Behavioral Problems in Word – perhaps you can find the culprit.

            • #1074034

              It probably has to do with language support for some exotic languages … something about OpenType Layout Tables.

              Simple fonts don’t have these tables, but the bigger fonts that contain Hebrew, Arab, Asian… glyphs do.
              If I understand these issues correctly (not sure), these fonts are mapped by Word.
              In effect the layout tables are handles as if they were different fonts: One for Latin/western (Ascii) text, one for bidirectional (Hebrew or Arab) text, one for Asian text, and one for other complex scripts.

              The work-around if this leads to problems is to use Font.NameAscii instead of Font.Name in the macro.
              I saw the original poster already got that info in the MS newsgroups… just for the record here, in case somebody else stumbles on this issue.

              cheers Klaus

    • #1075065

      If you have gone from Office 2000 to 2003, then most if not all of your fonts will have gone from being TrueType to OpenType, and the filenames for them will be different. Just changing the version number to a more recent version of an OpenType font has changed the filenames in some cases. The font name stays the same, but the filename (in WindowsFonts) is different.

      I don’t know if that has a bearing on your problem or not, but it can be a source of confusion.

    Viewing 1 reply thread
    Reply To: Font search parameters in Word 2003 (Word 2003 SP

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: