Indexing Names

Indexing Names

Post by RGVpZHJlN » Tue, 31 Aug 2004 19:53:06


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?
 
 
 

Indexing Names

Post by Klaus Link » Tue, 31 Aug 2004 20:37:38


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://www.yqcomputer.com/
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