Bob Doerr 0 Newbie Poster

Long ago, in the days of Word 2, I wrote a very successful macro ('surname first') in WordBasic.

Its purpose was to create proper index entries from text.

Because it was used to index a big book, it was apparent that the user, mousing the text, would often inadvertently include in the selection leading or trailing blanks or punctuation, the first thing the macro would do was to delete all such. But it was desired to retain proper punctuation for the pre-nominals and post-nominals (Dr., etc.).

Here's what it did, by a few examples:

TEXT RESULTING ENTRY

Joe Blow....................................Blow, Joe
Dr. Tom Blow.............................Blow, Tom, Dr.
Tom Blow, M.D. .........................Blow, Tom, M.D.
Dr. John Doe, PhD......................Doe, John, Dr., PhD
Mrs. Jane Doe............................Doe, Jane, Mrs.

The macro covered many other pre- and post-nominals, but only ones that I included in the macro.

There was also this condition:

Mrs. Jane (Smith) Doe

For this, a dialog box appeared, "Parentheses detected; do you want two index entries?"
If the 'Yes' box was clicked, the entries were
Doe, Jane, Mrs.
and
Smith, Jane

If the 'No' box was clicked, the entry was
Doe, Jane (Smith), Mrs.

Well, now I am facing a like, but much larger, project.

But Word 2000, which I now use with XP Pro, requires for macros not Word Basic, but VBA. I do not know VBA and even had to get expert help to get the tiny macro (below) to 'go relative', to use terminology from Excel. [This one enables a single key combination (I use Alt-Z.) to insert an index entry for a selection, but indexes the selection strictly as-is.]

Sub MarkIndexEntry()
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, Entry:=Selection.Text, EntryAutoText:=Selection.Text
End Sub

The options that I recognize are:
1. Find a suitable macro on line; I have searched and as yet found none.
2. Gather all of my old hard drives, copy all the data therefrom, and seek the old WordBasic macro. Then, if I can find it,
a) Save the present documents in .RTF and use the old macro to create the index in Word 2, or
b) Somehow translate the macro to VBA for use with Word 2000.
3. Find a suitable macro.

Could you please guide me to a macro or a collection of Word macros?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.