Results 1 to 12 of 12
  1. #1
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Captions and Heading Styles (2003)

    Hi,

    hopefully my last ever question on VB for Word (yeah right :-) !)

    I have a macro to automatically enter figure/table captions in the style that i want as standard. Cool, no problem. The captions include the chapter number, based on Heading 1 style. The problem is, we would wish the Caption to look like "Figure A-1 - blah blah" for the Annex A for example. However, the Annex Style is based on Heading 7 (legacy, don't ask..) rather than Heading 1, therefore I get "Figure 3-1 - blah blah" instead, for example.

    A similar issue exists for the Header/Footer numbering, but this includes Section numbers, rather than Chapter numbers. I can get a page of "A-23" for example, because for this section I can specify that the header/footer numbering is based on Heading 7.

    But Captions use Chapters, not Sections. I assume that the linking of Chapter Number to the Caption style is a document-wide thing, rather than being limited only to the Section?

    In my VB therefore, if a user presses a toolbar button to insert a caption in an Annex, how can I know that i'm now in an Annex and need to associate the caption style with Heading 7 rather than Heading 1?

    EAch Annex is in a separate Section, if that helps in any way.

    cheers muchly !
    Dom

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

    Re: Captions and Heading Styles (2003)

    You can specify which heading style you want to use as "chapter" in the caption number - see section 5 in Why use Microsoft Word's built-in Heading styles?

  3. #3
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Captions and Heading Styles (2003)

    thanks for the reply - you can set the heading level for the Chapter on a per-Caption basis. OK. But how do i know that the caption is to be in an Annex, rather than the main body, and therefore in this instance, Heading 7 should be used rather than heading 1? I can't detect where I am in the document and I don't want the user to have to select if they are in an Annex or the main body. See what i mean?

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

    Re: Captions and Heading Styles (2003)

    Do you know which sections are Annexes? Selection.Information(wdActiveEndSectionNumber) will give you the section number of the selection.

  5. #5
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Captions and Heading Styles (2003)

    it's not fixed - the document could have any number of sections :-(

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

    Re: Captions and Heading Styles (2003)

    I guess you could search backwards from the selection for Heading 7. If found, you know you're in an Annex, otherwise you aren't.

  7. #7
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Captions and Heading Styles (2003)

    well, that's the conclusion I came to too. The next question, which you probably can't answer is: can I be bothered? :-)

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

    Re: Captions and Heading Styles (2003)

    That's for you to decide...

  9. #9
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Captions and Heading Styles (2003)

    you should get some sleep, unless you're a clever bot!

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

    Re: Captions and Heading Styles (2003)

    It's 8:45 AM where I am, I'm off to work in a minute...

  11. #11
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Captions and Heading Styles (2003)

    Europe then, same as me.

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

    Re: Captions and Heading Styles (2003)

    Yep - click my username to see where I am located.

Posting Permissions

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