Word 2000

I have a string of text that contains an unknown character. I need to
identify the character code. I've done this before, so I know that it's
possible, but I'm drawing a complete blank on the command that I used, and I
haven't been able to find the information in Help.

Can someone show me how to get the character code of an unknown character?

-- Tom

State of Montana
Department of Justice Help Desk

"Making the world a safer place."

Re: Identifying Character in a Text String by Jean-Guy

Jean-Guy
Fri Jan 14 00:11:55 CST 2005

Montana DOJ Help Desk was telling us:
Montana DOJ Help Desk nous racontait que :

> Word 2000
>
> I have a string of text that contains an unknown character. I need to
> identify the character code. I've done this before, so I know that
> it's possible, but I'm drawing a complete blank on the command that I
> used, and I haven't been able to find the information in Help.
>
> Can someone show me how to get the character code of an unknown
> character?
>


Select one character on the page and try:
MyCharCode = Asc(Selection.Text)

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: Identifying Character in a Text String by Klaus

Klaus
Fri Jan 14 10:29:22 CST 2005

"Jean-Guy Marcil" wrote:
> Select one character on the page and try:
> MyCharCode = Asc(Selection.Text)

Better use AscW.
Asc only works for the 200 or so most widely used characters, and returns the codes from the old Windows code page 1252, which
differs in some cases from the "real" (Unicode) codes.

Regards,
Klaus



Re: Identifying Character in a Text String by Jean-Guy

Jean-Guy
Fri Jan 14 10:41:02 CST 2005

Klaus Linke was telling us:
Klaus Linke nous racontait que :

> "Jean-Guy Marcil" wrote:
>> Select one character on the page and try:
>> MyCharCode = Asc(Selection.Text)

Good to know!

Will AscW return the real Unicode number for the Wingding et all. sets (or
other inserted "symbols")?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: Identifying Character in a Text String by Klaus

Klaus
Fri Jan 14 13:43:52 CST 2005

> Will AscW return the real Unicode number for the Wingding et all.=20
> sets (or other inserted "symbols")?

With regular fonts, you don't have much problems.
Each symbol has it's specific code, independent of the font.

Say 263A, Alt+X (or using the decimal code: Alt+9786) produces the =
Unicode character "white smiling face", or smiley (though most fonts may =
not contain that special symbol).
AscW(Selection.Text) used on that character will give you 9786,
Hex(AscW(Selection.Text)) will give you 263A.

But decorative fonts like the Wingdings font you have mentioned are =
problematic.
Word has no way to determine what symbols such a symbol font may =
contain.
Those symbols aren't even necessarily defined in the Unicode Standard.

So Word uses codes in the code page at U+F000 (decimal 61440) for them.

Take a "smiley" from Wingdings as an example,=20
-- It is produced by the "J" key
(which has hex code 4A, or decimal code 74)=20
-- corresponds to U+F04A (=3D F000+4A)
equals decimal 61514 (61440+74)

You can for example search for it with u+61514 in "Find what".
Or you can insert it in text using ChrW(61514) or ChrW(&HF04A) in a =
macro (or F04A, Alt+X, or Alt+61514, in text), and format it in =
"Wingdings" font.
Here you need both the code and the font to specify the character.

Regards,
Klaus

Re: Identifying Character in a Text String by Jean-Guy

Jean-Guy
Fri Jan 14 14:57:30 CST 2005

Klaus Linke was telling us:
Klaus Linke nous racontait que :

>> Will AscW return the real Unicode number for the Wingding et all.
>> sets (or other inserted "symbols")?
>
> With regular fonts, you don't have much problems.
> Each symbol has it's specific code, independent of the font.
>
> Say 263A, Alt+X (or using the decimal code: Alt+9786) produces the
> Unicode character "white smiling face", or smiley (though most fonts
> may not contain that special symbol).
> AscW(Selection.Text) used on that character will give you 9786,
> Hex(AscW(Selection.Text)) will give you 263A.
>
> But decorative fonts like the Wingdings font you have mentioned are
> problematic.
> Word has no way to determine what symbols such a symbol font may
> contain.
> Those symbols aren't even necessarily defined in the Unicode Standard.
>
> So Word uses codes in the code page at U+F000 (decimal 61440) for
> them.
>
> Take a "smiley" from Wingdings as an example,
> -- It is produced by the "J" key
> (which has hex code 4A, or decimal code 74)
> -- corresponds to U+F04A (= F000+4A)
> equals decimal 61514 (61440+74)
>
> You can for example search for it with u+61514 in "Find what".
> Or you can insert it in text using ChrW(61514) or ChrW(&HF04A) in a
> macro (or F04A, Alt+X, or Alt+61514, in text), and format it in
> "Wingdings" font.
> Here you need both the code and the font to specify the character.
>

Ouch!
Messy!

Thanks for taking the time!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: Identifying Character in a Text String by Klaus

Klaus
Fri Jan 14 16:29:34 CST 2005

> Ouch!
> Messy!

Well, not at all if you can avoid decorative (symbol) fonts...

> Thanks for taking the time!

Pas de quoi!
Klaus



Re: Identifying Character in a Text String by Montana

Montana
Mon Jan 17 23:32:48 CST 2005

Thanks for the help! That's exactly what I needed. I was thinking that the
last time I did this, I used a variation of the Chr function, so I was
looking right past the Asc function, even though it is listed in the See
Also list under several topics that I had previously looked at in Help. I
just had this pre-conceived notion of where I was suppose to be looking, and
I just could not break out of that mindset.

-- Tom

State of Montana
Department of Justice Help Desk

"Making the world a safer place."
"Jean-Guy Marcil" <no-spam@leaveme.alone> wrote in message
news:uww9z$f%23EHA.3260@TK2MSFTNGP14.phx.gbl...
> Montana DOJ Help Desk was telling us:
> Montana DOJ Help Desk nous racontait que :
>
> > Word 2000
> >
> > I have a string of text that contains an unknown character. I need to
> > identify the character code. I've done this before, so I know that
> > it's possible, but I'm drawing a complete blank on the command that I
> > used, and I haven't been able to find the information in Help.
> >
> > Can someone show me how to get the character code of an unknown
> > character?
> >
>
>
> Select one character on the page and try:
> MyCharCode = Asc(Selection.Text)
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>