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

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Built-in Style IDs from Style Object? (All)

    Author
    Topic
    #417519

    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:

    For Each oSt in ActiveDocument.Styles
        If oSt.BuiltIn then
           'What is the ID Number?
        End If
    Next
    

    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

    Viewing 0 reply threads
    Author
    Replies
    • #937021

      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.

      • #937083

        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

    Viewing 0 reply threads
    Reply To: Built-in Style IDs from Style Object? (All)

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

    Your information: