• Find the bullet symbol (VBA for Word 97/2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Find the bullet symbol (VBA for Word 97/2000)

    Author
    Topic
    #364214

    Edited by TroyWells on 15-Dec-01 22:36.

    OK, I’m getting closer, but I’m not there yet.
    I’m having trouble find the symbol used in a bullet. I want to find it so I can add it to a label.

    I basically want something like this:

    ExistingNumberStyleExample = ChrW(Font:= _
    ExistingNumberFormatFont, CharacterNumber:=ExistingNumberFormat, Unicode _
    :=True)

    But of course that doesn’t work. HELP!!
    Thanks!!
    Troy

    Previously I wrote:

    I’ve tried:

    ExistingListLevelNumber = Selection.Paragraphs(1).Range.ListFormat.ListLevelNumber
    MsgBox Asc(Selection.Paragraphs(1).Range.ListFormat.ListTemplate.ListLevels(ExistingListLevelNumber).NumberFormat)

    But the only output I get is “63”. And if I try:

    MsgBox ChrW(63)

    I find that all I have is a “?”

    This happened, for example, when I put the diamond shape bullet on a paragraph.

    Thanks again for all your help!!
    Troy

    Viewing 2 reply threads
    Author
    Replies
    • #558550

      I can’t help with the main part of your question, but I can tell you that character 63 is a question mark – that’s why you get “?” when you enter it! (To see what I mean, in a normal document, hold down Alt and type 63 on the numerical keypad, then release Alt).

      smile

    • #558564

      I guess you nearly got it: Just use AscW instead of Asc.
      (Asc will convert the code of the Unicode bullet to Ascii, and so you get the question mark for most Unicode characters)

      For codes > 32767 (=U+0FFF), for example with all bullets from decorative fonts like “Symbol” or “Wingdings”, you’ll get negative values (because Word uses a signed integer for the code); if you prefer to use positive codes only, you can use
      &HFFFF& And AscW()
      instead of
      AscW()
      (This produces a long integer, with an “unsigned” positive value)

      cheersKlaus

      • #558805

        What do you mean by “&HFFFF& And AscW()”? How do you use the &HFFFF and the AscW together to generate the correct symbol?

        An example of the AscW output I’m getting is -3928.

        I need to be able to reproduce this symbol in a label.

        Thanks!!
        Troy

        • #558874

          Hi Troy,

          We’re in deep geek territory now …
          Integers are two bytes long (= 16 bit), Long integers 4 bytes (= 32 bit).
          Whether the integer is positive or negative is determined by the leftmost bit (if it’s 1, the number is negative).
          &HFFFF& is a long integer (the “&” at the end enforces this).
          In this number, the right 16 bits are 1, the left 16 are 0.
          “And” has the effect that all bits of the other number come through if the bit is 1, and are 0 if the bit is 0 (that “masks” the left 16 bits).

          For your example -3928:

          -3928 =  &HF0A8 (a "negative" short integer),
          converted to long: &HFFFFF0A8 = 
                1111 1111 1111 1111 1111 0000 1010 1000
          AND   0000 0000 0000 0000 1111 1111 1111 1111
          ------------------------------------------------------------------------------- 
           =    0000 0000 0000 0000 1111 0000 1010 1000
           =    &H0000F0A8 = 61608

          You could also have used ChrW(-3928) to output the character, but I prefer positive values (and sometimes, you *do* need them): ChrW(61608).

          Word uses codes starting at &HF000 for the old decorative fonts like Symbol or Wingdings. With a bit of arithmetic, you see that you can get the old ASCII codes for them by adding 4096: -3928+4096=168.
          So in this special case you could also use Chr(168).

          You still need the font:
          MsgBox Selection.Paragraphs(1).Range.ListFormat.ListTemplate.ListLevels(ExistingListLevelNumber).Font.Name

          cheersRegards, Klaus

    • #558549

      Edited by gwhitfield on 18-Dec-01 05:53.

      Markup added

      Is this any use?

      http://www.bbsinc.com/symbol.html

      Mark

    Viewing 2 reply threads
    Reply To: Find the bullet symbol (VBA for Word 97/2000)

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

    Your information: