.Find and accent marks over letters

C

Culichi

Hi--

I'm using Word XP and VB 6.xx. I've written a macro that does a series
of word searches that works well, but I recently discovered that it's
not recognizing words with accent marks.

Here's what the basic code for finding and marking a word looks like:

'DoSearch is a Find variable defined earlier in the program
With DoSearch
.ClearFormatting
.MatchCase = False
.MatchWholeWord = False
While DoSearch.Execute(FindText:="motin")
With CurrPane.Selection.FormattedText
.HighlightColorIndex = wdGray50
End With
Wend
End With

The text being searched is in Spanish, and so this word--"motin"--should
have an accent over the "i". This search returns "motines", which has no
accent in the plural, but not the singular that has the accent.

It seemed logical to just add another round of this code sequence with
the accented form of the word, but VBA isn't letting me add an accent
over the "i" (at least not using the conventional Ctrl+"'" then "i").

Question: Is there a different way to identify the "i" as accented
within VBA?

Question: Is there an additional modifier, like .ClearFormatting, that
would tell it to ignore accents?

Any help would be greatly appreciated.

Thanks!

Kelley
 
J

Jean-Guy Marcil

Hi Kelley,

ALT-0204 = Ì = Chr(204)
ALT-0205 = Í = Chr(205)
ALT-0236 = ì = Chr(236)
ALT-0237 = í = Chr(237)

I do not think you can tell the routine to ignore accents using formatting.
Accents are not inserted through formatting, but are part of the character,
the same way the horizontal bar in the "H" is part of the "H". They are not
added over the letter (although it may seem that way when entering them with
various key combinations on the keyboard). I mean, "ê" is not the character
"e" plus some formatting to produce "ê", it is the character "ê", or ê
(ALT-0234).

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

Culichi

Thanks for the help. That makes perfect sense . . . almost.

I'm almost embarassed to ask this, but now how do I make that appear in
my VBA code? That is, I write the code line:

While DoSearch.Execute(FindText:="mot

and I want the next charater (after m-o-t) to be a right-accent "i" ...

I tried holding the ALT key and keying in 0-2-3-7, but nothing happens.
I tried a few other variations of this and I can't get it appear in the
code. Again, sorry for being so ignorant about this, but can tell me to
make this work? : )

Thanks for your help!

Kelley
 
J

Jean-Guy Marcil

Hi Kelley,

Are you using the left ALT key and the numerical keypad?
If I do that it works in my VBE.
If you are, and it is not working, then, try it in Notepad, or something
like that, select it and copy/paste it in the VBE.

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

Culichi

Jean-Guy,

I can't figure out why it doesn't work. I'm working on a Dell Inspiron
5150 laptop, so I don't have a number pad. I did notice that there is
"number lock" function, and tried turning that on (no effect). I
couldn't make it work in Notepad, either.

But, that good idea finally solved the problem: I just copied the
accented "i" out of Word and pasted it into the VBE. Don't know why I
didn't think of that; I once got so frustrated that I couldn't find the
"~" while working on a keyboard in Mexico that I put the single
character in a Notepad file and transferred it to the offending computer
on diskette. Live and learn, I guess (again) . . .

Thanks for your help.

Kelley
 
J

Jean-Guy Marcil

Hi Kelley,

IIRC, there is a function on a laptop to simulate the numerical keypad, but
every laptop is a little defend. I do not think it would be "Num Lock". Very
often it is colour coded... E.g. there is a "blue" function key that turns a
section of the keyboard in a temporary numerical keypad (i.e. the keys that
have "blue" numbers above them on the keypad).

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

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