Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Harrisburg, Pennsylvania, USA
    Posts
    44
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Character Mapping

    Good Afternoon!
    Do any of the VBA Gods & Godesses out there have any idea how MS Word identifies the font in use?
    I am working on a macro to convert certain "symbols" of a certain font - into the equivalent "symbol" of a different font. I tried using the information that the Word window is giving me - but it doesn't seem to be accurate. (ie - select a symbol and the font indicator - formatting toolbar - says one font name... but when searching for that font with Find/Replace, Word says it can't be found).
    BTW - Word 2000 with SR-1
    I would love to break into Word's macros to look at the code... but can't find that back door! <img src=/S/wink.gif border=0 width=15 height=15>
    If anyone out there could lend a hand - I would be most appreciative. My users are starting to hit the frustration level earlier in the day and it makes for a very loooong day!

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Character Mapping

    The Symbol font is especially nasty. Check out the thread on greek characters either on this board or the Word board.

  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Harrisburg, Pennsylvania, USA
    Posts
    44
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Re: Character Mapping

    Thanks! One of my colleagues saw your response and searched for the thread you mentioned (it was over on the Word side - <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=wrd&Number=23114&page=& view=&sb=&vc=1#Post23114>Post#: 23114 / re: 21129</A> ). We've checked out the MS
    supplemental macros that the other post links to and we think we can make it work. Thanks for the help!

    *** Geoff W URL Markup added ***

  4. #4
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Character Mapping

    I'm having a similar problem trying to revamp my <A target="_blank" HREF=http://www.addbalance.com/word/download/index.htm> Checkbox template</A> for use without AutoText. I tried a modification of the Knowledge Base article but all the symbols I'm using show the same Unicode Value (40).

    Does anyone know of a reference for the Unicode values of Wingdings2?

    The KB has an article that allows search by example and that is the one I converted. My code is as follows:
    <pre>Sub UniCodeSpecialMessage()
    'Macro from Microsoft Knowledge Base to find
    'the Unicode Number of a Special Character</pre>

    '<A target="_blank" HREF=http://support.microsoft.com/support/kb/articles/Q212/4/03.ASP>http://support.microsoft.com/support/kb/ar...s/Q212/4/03.ASP</A>
    <pre> 'modified by Charles K. Kenyon to display
    ' Unicode Number rather than find next
    Dim strText As String
    ' If the length of the selection is 1 character,
    ' then get Unicode value of selection. Otherwise,
    ' leave variable set to null value.
    If Len(Selection.Text) = 1 Then
    ' strText = "^u" & AscW(Selection.Text) 'original line
    strText = AscW(Selection.Text)
    MsgBox Prompt:="The Unicode value is " _
    strText, Title:="Unicode Display"
    Else
    MsgBox Prompt:="This only works for a single " _
    & "character!", _
    Buttons:=vbExclamation, _
    Title:="Unicode Display - ERROR!"
    End If
    Selection.Collapse
    On Error Resume Next
    ' ' Show Edit Find dialog box.
    ' With Dialogs(wdDialogEditFind)
    ' .Find = strText
    ' .Format = False
    ' .Show
    ' End With
    End Sub</pre>


    Another KB article lets you search by number, but I'm trying to find unique numbers for various symbols and not having much luck. That KB article is <A target="_blank" HREF=http://support.microsoft.com/support/kb/articles/Q211/4/35.ASP>http://support.microsoft.com/support/kb/ar...s/Q211/4/35.ASP</A>.

    I did record a macro that gives me the code to insert the symbols (but not Unicode). The thing is, I'm trying to use a macro that not only inserts them but reads them.

    The recorded code is:
    <pre>Sub InsertSpecCharsMacro()
    '
    ' InsertSpecCharsMacro Macro
    ' Macro recorded 10/15/01 by Charles K. Kenyon
    '
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-3933, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-4014, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-4013, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-4012, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-4015, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-4016, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-4017, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-3938, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-3942, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-3943, _
    Unicode:=True
    Selection.InsertSymbol Font:="Wingdings 2", _
    CharacterNumber:=-3927, _
    Unicode:=True
    End Sub</pre>


    Thank you for any ideas.
    Charles Kyle Kenyon
    Madison, Wisconsin

  5. #5
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Character Mapping

    Followup...
    I've found an article by Dave Rado that may help me. Need to sleep first, though.
    <A target="_blank" HREF=http://www.mvps.org/word/FAQs/MacrosVBA/FindReplaceSymbols.htm>Finding and replacing symbols</A> It looks much more thorough than the ones on the KB.
    Charles Kyle Kenyon
    Madison, Wisconsin

  6. #6
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Character Mapping

    Hi Charles,

    I'd make a small change to Dave's macro:
    <pre>Sub GetCharNoAndFont()
    With Dialogs(wdDialogInsertSymbol)
    Debug.Print "Font: " & .Font
    Debug.Print "Char number " & (.CharNum And &HFFFF&)
    End With
    End Sub</pre>

    Unicode characters need two bytes, and because there are no unsigned integers in VBA, .CharNum is interpreted as a *signed* integer, and you get negative values for symbols. (.CharNum And &HFFFF&) changes that to a (positive) long integer.

    You'll get the same (positive) code if you select the character and look into "Insert > Symbol... > Keyboard shortcut". You can then find that character if you search for ^uXXXXX (or for ChrW(XXXXX) with a macro).

    With the <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Board=wrd&Number=77886>document appended here</A>, you can make a code table if you change the character style "Decorative" from "Marlett" to "Wingdings2".
    <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Board=wrd&Number=57958>This thread</A> may have more useful information (for example on when and why you get "40" as the code, or what's so special about decorative fonts).

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>Greetings, Klaus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •