Indexing Names

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

Guest

I need to index hundreds of people's names in a word document. How can I mark
the index entries without having to retype each name in a last name first
format?
 
Deidre5 said:
I need to index hundreds of people's names in a word document.
How can I mark the index entries without having to retype each
name in a last name first format?


Hi Deidre,

I think you need a macro to do that effectively (see below).
You can assign a keyboard shortcut to this macro.

See http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm if you need help
with that.

' select a name, then run the macro to
' add an index entry (lastname, firstname) for it
Dim strName As String
strName = Selection.Text
If InStr(1, strName, " ") > 0 Then
strName = _
Mid(strName, InStrRev(strName, " ")) _
& ", " _
& Left(strName, InStrRev(strName, " "))
End If
ActiveDocument.Indexes.MarkEntry _
Range:=Selection.Range, _
Entry:=strName

Regards,
Klaus
 
Back
Top