Macro for an Index in a book

G

Guest

I am using Word in Office 2003 on Windows XP.

I am creating an Index for a book of over 250 pages. The author does not
wish to use a concordance file as it will include too many unnecessary
entries of some of the words.

I have been manually selecting the words to create the index and tried to
record a macro to quicken the process up but found that when I ran the simple
macro it placed all the selected words under the same index letter as the
word that was used when recording the macro. For example, if I selected
"essential advice" while recording the macro the "essential advice" words
would be listed under E at the back of the book in the Index, but when I
selected another word, say, "registry key" and ran the macro, the words
"registry key" was also listed under E instead of R.

I need to be able to record a macro without it remembering the word/s I
selected when recording it so that when I selected other words it would place
the word/s in its correct alphabetical place within the list.

Hope this is all clear enough.

Lyn
 
S

Stefan Blom

Try something like this:

Sub TestingIndexEntryCreation()

Dim EntryText As String
EntryText = Selection.Range.Text

ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, Entry:= _
EntryText, CrossReference:="", _
CrossReferenceAutoText:="", BookmarkName:="", Bold:=False, _
Italic:=False

End Sub

Note that no testing is performed to make sure that you actually
selected something.

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
G

Guest

Stefan, many thanks, but my macro skills are very basic. How do I step
through your instructions? The macro that I recorded was merely switching on
the macro and recording key strokes and switching off again. I am fairly
skilled in most MS products but have not had to use macros so much. Lyn
 

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