Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How can I list all Numbering Styles? (Word 2002)

    Hi,

    Using VBA, how do you list all of the Numbering Styles? (See attached image)

    Thanks, Chris
    Attached Images Attached Images

  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: How can I list all Numbering Styles? (Word 2002)

    Try this:
    1. <LI>Record a macro of altering a style with a numbered list, including playing with the list numbering style (for good measure) and applying that to the current selection.
      <LI>In the VB Editor, examine the code of your recorded macro and you will see that the ListLevel object is the one that has the NumberStyle property.
      <LI>Highlight NumberStyle and hit F1 to read up on it in the online help.
      <LI>In the VB Editor, hit F2 to call up the Object Browser, and do a search on NumberStyle. Highlight the line that says Word ListLevel NumberStyle.
      <LI>Notice that the bottom pane says "Property NumberStyle As WdListNumberStyle"; click WdListNumberStyle to display all of the enumerated constants.
    This methodology is useful for discovering the whereabouts of most everything in the Word object model. Naturally, there are some exceptions, but this will take you quite far.

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How can I list all Numbering Styles? (Word 2002)

    Thanks for a great tip! Very useful indeed.

    One quick question. I have been trying to add each of the WdListNumberStyle members using...

    cboNumberingStyle.AddItem Word.wdListNumberStyleAiueo
    cboNumberingStyle.AddItem Word.wdListNumberStyleAiueoHalfWidth
    cboNumberingStyle.AddItem Word.wdListNumberStyleArabic

    etc...

    Is there a better way of doing this? Despite it being rather long winded, my combo box just displays a numeric value instead of the actual name.

    Also, do you have any idea how I might implement the 'New picture...' and 'New Bullet....' options which feature at the end of the list?

    Thanks, Chris

    P.S Forgive me if I am missing the obvious when it comes to this, but I am still a relative novice!

  4. #4
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How can I list all Numbering Styles? (Word 2002)

    Hmmmm. I think there must be some sort of list somewhere. Can anybody advise on this?

    Also, does anybody know how to develop the 'New Picture...' functionality? (See attached image). The user clicks on 'New Picture...' in the drop down list and the Picture Bullet window pops up.

    Thanks, Chris
    Attached Images Attached Images

  5. #5
    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: How can I list all Numbering Styles? (Word 2002)

    <P ID="edit" class=small>(Edited by jscher2000 on 12-Jan-03 10:51. )</P>Somewhere there must be a secret list that translates the numbers/constants into the text that appears in the dialog. I'm not sure whether VBA can access this, or whether you need to create your own array. (Once you create the array, of course, you can push it pretty much directly into a listbox.)

    New Material Added - Example
    <pre>Sub ListKeyBindings()
    ' List key assignments in Normal.dot
    CustomizationContext = NormalTemplate
    Dim kb As KeyBinding
    Debug.Print "Command Type", "Key(s) Assigned", "Command/Symbol/Macro/etc."
    Debug.Print String(12, "="), String(26, "="), String(26, "=")
    For Each kb In KeyBindings
    Debug.Print KeyBindingCategory(kb.KeyCategory), _
    kb.KeyString & Space(26 - Len(kb.KeyString)), kb.Command
    Next
    End Sub

    Function KeyBindingCategory(lngCommandType As Long) As String
    Select Case lngCommandType
    Case -1
    KeyBindingCategory = "Nil"
    Case 0
    KeyBindingCategory = "Disable"
    Case 1
    KeyBindingCategory = "Command"
    Case 2
    KeyBindingCategory = "Macro"
    Case 3
    KeyBindingCategory = "Font"
    Case 4
    KeyBindingCategory = "AutoText"
    Case 5
    KeyBindingCategory = "Style"
    Case 6
    KeyBindingCategory = "Symbol"
    Case 7
    KeyBindingCategory = "Prefix"
    Case Else
    KeyBindingCategory = "Unknown!!"
    End Select
    End Function</pre>

    Even if I found a way to return Word's constants, they aren't the most user-friendly strings. It was faster to do it myself.

Posting Permissions

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