Indexing Names

D

Deidre5

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?
 
K

Klaus Linke

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top