Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

Wingdings font returns ??? text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
An Hong Phan - 13 Jul 2005 20:25 GMT
Hello,

I'm trying to get Text from Word doc by calling

Range.Text

Most of the time it returns the right string, however, For Wingdings font,
all I get out of it is a series of "?????"

How do I get the text or character codes for Wingdings text?

Thanks.
Klaus Linke - 13 Jul 2005 22:20 GMT
Hi,

Word uses the "private area" Unicode block starting at U+F000 for symbol
fonts.

The text doesn't actually consist of question marks -- You only get "?"
because neither the VBA editor nor Message boxes can deal with Unicode.

If you have some string with symbols in it and want to have the characters
as you typed them in on the keyboard (= map the codes to the 1-byte codes
below 256 that were used in pre-Unicode times), you could use something like

Dim i As Long
Dim myString As String
myString = Selection.Text
For i = 1 To Len(myString)
 Select Case AscW(Mid(myString, i, 1))
   Case &HF000 To &HF0FF
     Mid(myString, i, 1) = _
       ChrW(AscW(Mid(myString, i, 1)) - &HF000)
 End Select
Next i
MsgBox myString

Or you can get the code of some selected symbol with
? AscW(Selection.Text) And &HFFFF&

(... the "And &HFFFF&" is needed because AscW returns a signed integer, and
you get negative numbers between &H7FFF and &HFFFF, so you convert it to a
Long variable with 4 bytes instead of 2, and mask the upper 2 bytes)

Or if you prefer a string with the hex number:
? Hex(AscW(Selection.Text))

Regards,
Klaus

> Hello,
>
[quoted text clipped - 8 lines]
>
> Thanks.
An Hong Phan - 14 Jul 2005 19:35 GMT
Thank you very much!!! That's exactly what I'd need to do.
You saved my day.
Thanks,

- An H. Phan -
> Hi,
>
[quoted text clipped - 47 lines]
>>
>> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.