Creating Multiple Indices

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a very large Word 2003 document - 350 + pages - in which I need to
create 2 indices, one subject and one surname. I cannot, for the life of me,
figure out how to create 2 indices in the same document.

Any help and/or guidance is GREATLY appreciated!

Thank you in advance!
 
You need the field switch \f with some letter for each type of index, both
in the XE index entry fields, and in the INDEX field that creates the index.
Say (since "s" might be confusing in your example) \f "t" for topics and \f
"n" for names:
{ XE "Some name" \f "n" } or { XE "Some topic" \f "t" }, and then
{ INDEX \f "n" } or { INDEX \f "t" } for an index just with those entries.
As far as I know, only one letter is allowed (or used)... There is something
in the help on it.

I usually add the XE fields with macros, or by hand, anyway... but I don't
think there's a way to add the switch from the dialog.
Even the usual VBA method, Indexes.MarkEntry, does not know about that
switch.

But you can use character styles for the names, and the topics (which has
the added advantage that you can format them any way you like at any time,
or highlight them temporarily), and then use a macro to add the XE fields...
The one below is for a character style called "name style", and adds XE
fields with an \f "n" switch -- Of course, you could adapt it to another
style name or switch.

Regards,
Klaus

Sub CharStyleToIndex2()
' marks up all text formatted in some char style
' as index entries
Dim myCharStyle As String
' Insert the name of your char style here:
myCharStyle = "name style"
Dim strEntry As String
Application.ScreenUpdating = False
ActiveWindow.View.ShowAll = False
ActiveWindow.View.ShowHiddenText = False
Selection.HomeKey (wdStory)
With Selection.Find
.ClearFormatting
.Style = myCharStyle
.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
End With
While Selection.Find.Execute
strEntry = Selection.Text
Selection.Collapse (wdCollapseEnd)
ActiveDocument.Fields.Add _
Range:=Selection.Range, _
Type:=wdFieldIndexEntry, _
Text:="""" & strEntry & """ \f ""n""", _
PreserveFormatting:=False

Selection.Collapse (wdCollapseEnd)
Wend
End Sub


Regards,
Klaus
 
BTW, so you don't end up with an inflation of XE fields in your document:
You can delete them all with one replacement: Show hidden text, so the XE
fields are visible, and replace ^d XE with nothing.
(^d is the placeholder for a field brace, and if you match part of a field,
the whole field will be found)

Regards,
Klaus
 
Back
Top