• MS Word – change header level for auto-numbered figure captions with STYLEREF

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » MS Word – change header level for auto-numbered figure captions with STYLEREF

    Author
    Topic
    #508101

    I’m struggling with auto-numbered figure captions on a document that goes down to several levels of section numbering. It’s set up with Heading 1 through Heading 5, but not every section goes all of the way down.

    When I insert a caption, it asks if I want to refer to Heading 1, Heading 2, or whatever level heading. However, the issue is that it will apply that style to all captions in the document, and it won’t differentiate if there’s another heading in between.

    To try to illustrate it, let’s say my document goes like

    Section 1 (Heading 1)
    Section 1.1 (Heading 2)
    Section 1.2 (Heading 2)
    Figure 1.2-1
    Figure 1.2-2
    Section 2 (Heading 1)
    Figure 2-1

    If I set the captions to Heading 2, any figure that is in a section at a lower level goes to the previous Heading 2. So my Figure 2-1, that’s in Section 2, gets called Figure 1.2-3, because there is no Heading 3 between Section 2 and the figure.

    I’ve found that if I open up the Fields, it says {STYLEREF N s}, where N is whatever number heading I had set it to. So if the document is done, I can go into Figure E, edit the field and change the STYLEREF 2 to a STYLEREF 2 and it will look right.

    However, where I’m getting caught up is that next time I go through and add a caption, as soon as I hit the “Numbering…” button, it changes all STYLEREFs in the document to whatever I select.

    In a perfect world, I’d like to be able to add a caption and have the STYLEREF go to whichever the previous text that is either Heading 1, 2, 3, 4, or 5. I tried {STYLEREF “Heading 1” OR “Heading 2” s} and it gave me an error.

    In a less perfect world, I’d be OK with going through each caption and changing the STYLEREF manually, as long as it stays that way. However, the next time I add a new caption anywhere else, every caption changes to that STYLEREF.

    Any ideas?

    Viewing 0 reply threads
    Author
    Replies
    • #1590280

      This is a tricky little can of worms! Microsoft didn’t expect you to setup your document this way and adding Captions to a particular heading level via the GUI changes all the other captions.

      The ‘perfect world’ solution would require a macro to work out the preceding heading level and add the right fields. It would also probably need another macro to reset all captions if heading levels get adjusted during document edits. This same macro would be necessary to repair all the captions if someone happened to use the usual GUI to insert a caption.

      A workable ‘less perfect world’ solution would be to create each variant of the captions and store them as Quick Parts so they can be inserted when needed.

    Viewing 0 reply threads
    Reply To: MS Word – change header level for auto-numbered figure captions with STYLEREF

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

    Your information: