Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Mount Prospect, Illinois
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Built-in Style IDs from Style Object? (All)

    Is there any easy way to figure out the built-in style ID code (e.g. "Normal" is wdStyleNorma is -1) when you're iterating through the list of styles? There does not appear to be a .id or .index property for the style object:
    <pre>For Each oSt in ActiveDocument.Styles
    If oSt.BuiltIn then
    'What is the ID Number?
    End If
    Next
    </pre>


    I'm working on a tool to remap styles for imported text. It's for a multinational company, so "Heading 1" isn't called "Heading 1" in Germany, and I don't want to store the same style names in multiple languages in my remapping table.

    Worst-case scenario is re-iterating through the wdBuiltInStyle list to see which one matches the NameLocal, but that's a royal pain.

    Thanks,
    Joel

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Built-in Style IDs from Style Object? (All)

    I'm sorry, as far as I know there is no way to obtain the wdStyle... constant for a given style, except by testing the style against a list of those constants.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Mount Prospect, Illinois
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Built-in Style IDs from Style Object? (All)

    Hans,
    Yeah, I was afraid of that. Typical non-orthogonality of the MS Office object model.
    Most of the other objects have IDs, but styles are numbered less than zero for built-ins, and greater than zero alphabetically for user styles.
    Patently absurd. I may just have to create a collection with the .namelocal as the key and the number as the value... waste of precious time and space.

    Joel

Posting Permissions

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