Greetings, Gurus. I am trying to help automate the task of adding index entries in MS Word 2007. Unfortunately, I know NOTHING about Word macros.
In the below macro, I have selected the word "warehouse", then recorded the steps to adding "warehouse" to the index. Ideally I would like to select another word, run the macro, and THAT word would be added to the index. Unfortunately, that isn't happening.
Here's what I've got. Can someone help me to add the SELECTED word to the index?
Thanks in advance.
Code:Sub Add_to_Index() ActiveWindow.ActivePane.View.ShowAll = True ActiveDocument.Indexes.MarkAllEntries Range:=Selection.Range, Entry:= _ "warehouse", EntryAutoText:="warehouse", CrossReference:="", _ CrossReferenceAutoText:="", BookmarkName:="", Bold:=False, Italic:=False ActiveWindow.ActivePane.View.ShowAll = Not ActiveWindow.ActivePane.View. _ ShowAll End Sub
Last edited by hutch@edge.net; 06-23-2009 at 01:02 PM.
Like this maybe.
Code:Sub Add_to_Index() ActiveDocument.Indexes.MarkAllEntries Range:=Selection.Range, _ Entry:=Selection.Range.Text, _ EntryAutoText:=Selection.Range.Text, _ CrossReference:="", CrossReferenceAutoText:="", BookmarkName:="", _ Bold:=False, Italic:=False End Sub
Perfect, Andy. Thanks.
Have a good one!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks