Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There's an index that needs paragraph numbers in stead of page numbers.

    Is there a way to realize this?

    How can vba find the current paragraph number?

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    This is a tricky request and requires some lateral thinking to solve it. There may be a more elegant way to do it but this is one reasonable way to achieve what you want. The basic premise is that you include in each XE tag a paragraph number cross reference to the current paragraph. Then when you build the index itself, the paragraph numbers will appear instead of the page numbers.

    The steps to create the XE field are:
    1. Insert the XE tag as per normal and
    2. Select it and add the selection as a new bookmark eg named XE1
    3. Edit the code in the XE tag so that it includes at the end \t {Ref XE1 \n} where the {} brackets are inserted by pressing Ctrl-F9

    Each of your XE tags should end up looking like the following examples where the {} brackets are field codes and the Ref fields point to a corresponding bookmark which includes the XE field itself.
    {XE "Themes" \t {Ref XE1 \n}}
    {XE "Schemes" \t {Ref XE2 \n}}
    {XE "Automobiles" \t {Ref XE3 \n}}

    Automating this is not too difficult as long as you can work out how to create a unique bookmark name each time you have to create a new entry.

    Added: You could avoid the need to create bookmarks at all if you knew the heading levels were not going to change. Instead of using a Ref field you could use a StyleRef field and name the paragraph numbered style. This has the added benefit of working if the actual paragraph where the XE tag resides is not numbered but you want the index to point back to the nearest preceding heading number.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Mar 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Andrew,

    It works. Thank you very much.

    Rico Mazereeuw

Posting Permissions

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