J
Jon
Has anyone written a macro which will allow the user to create index entries
from section headings, like the current automatic TOC? I have in mind
something which will:
Open the reference document (i.e. the document to be indexed). Select each
Level One section. Bookmark it and give it a name based on the section
heading. Create an index entry after the heading using the text of the
section heading. Thus the Level One heading
The Pleistocene Era
would generate a unique bookmark "The_Pleistocene_Era_AA", containing
everything from the heading paragraph down to the end of that section
and an index entry { XE "The Pleistocene Era" \t "The_Pleistocene_Era_AA"}
Each heading will be truncated as necessary before being used as a bookmark
entry. Non-legal characters will be omitted or changed into legal
characters. Each heading will be given a unique suffix - AA, AB, AC, etc -
so that if two identical headings occur in different sections they will be
distinguishable.
Repeat for Levels Two, Three, etc, as necessary.
Some fiddling will be necessary because of the limitations on bookmark
names, which as I understand it:
a. Can only contain letters, digits and underlines
b. Cannot start with a digit
c. Must be 40 characters or less
d. Must be unique
But given these limitations it should be possible to create a Word macro
which would do all this in one step.
If there's not an existing macro then I'll have a go myself, but I thought I
should try and avoid reinventing the wheel.
Jon.
from section headings, like the current automatic TOC? I have in mind
something which will:
Open the reference document (i.e. the document to be indexed). Select each
Level One section. Bookmark it and give it a name based on the section
heading. Create an index entry after the heading using the text of the
section heading. Thus the Level One heading
The Pleistocene Era
would generate a unique bookmark "The_Pleistocene_Era_AA", containing
everything from the heading paragraph down to the end of that section
and an index entry { XE "The Pleistocene Era" \t "The_Pleistocene_Era_AA"}
Each heading will be truncated as necessary before being used as a bookmark
entry. Non-legal characters will be omitted or changed into legal
characters. Each heading will be given a unique suffix - AA, AB, AC, etc -
so that if two identical headings occur in different sections they will be
distinguishable.
Repeat for Levels Two, Three, etc, as necessary.
Some fiddling will be necessary because of the limitations on bookmark
names, which as I understand it:
a. Can only contain letters, digits and underlines
b. Cannot start with a digit
c. Must be 40 characters or less
d. Must be unique
But given these limitations it should be possible to create a Word macro
which would do all this in one step.
If there's not an existing macro then I'll have a go myself, but I thought I
should try and avoid reinventing the wheel.
Jon.