W
Wibs
OK, this isn't Excel, it's Word, but there is no forum for Wor
comparable to this forum for Excel, and as the problem is really VBA
thought, heh, give it a try.
I want to record a macro to help me with indexing a large book. The wa
to mark an index entry is to select the text, then press the ke
combination Shift+Alt+X, or on the Menu go to Insert, Index and Tables
Mark Entry. I would rather have this in a single key, such as F12.
My first try was to select a word, such as 'Beverley', in "Beverley i
a market town in the East Riding of Yorkshire. I then recorded in
macro the menu route. I then looked at the recorded macro, it looke
like this:
========================
Sub indexing()
ActiveWindow.ActivePane.View.ShowAll = True
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range
Entry:="Beverley" _
, EntryAutoText:="Beverley", CrossReference:=""
CrossReferenceAutoText:= _
"", BookmarkName:="", Bold:=False, Italic:=False
End Sub
========================
I can now assign this macro to the F12 key, so far no problem.
Of course, I cannot invoke this macro for every place I want to index
as each one would say 'Beverley'. I think I need to store the selecte
text into a variable, then replace the references to Beverley in th
macro with the variable. Have I got it right?
If anyone could fill in the missing bits of code I wuld be mos
grateful.
Regards, and Best Wishes for Christmas and the New Year,
Wib
comparable to this forum for Excel, and as the problem is really VBA
thought, heh, give it a try.
I want to record a macro to help me with indexing a large book. The wa
to mark an index entry is to select the text, then press the ke
combination Shift+Alt+X, or on the Menu go to Insert, Index and Tables
Mark Entry. I would rather have this in a single key, such as F12.
My first try was to select a word, such as 'Beverley', in "Beverley i
a market town in the East Riding of Yorkshire. I then recorded in
macro the menu route. I then looked at the recorded macro, it looke
like this:
========================
Sub indexing()
ActiveWindow.ActivePane.View.ShowAll = True
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range
Entry:="Beverley" _
, EntryAutoText:="Beverley", CrossReference:=""
CrossReferenceAutoText:= _
"", BookmarkName:="", Bold:=False, Italic:=False
End Sub
========================
I can now assign this macro to the F12 key, so far no problem.
Of course, I cannot invoke this macro for every place I want to index
as each one would say 'Beverley'. I think I need to store the selecte
text into a variable, then replace the references to Beverley in th
macro with the variable. Have I got it right?
If anyone could fill in the missing bits of code I wuld be mos
grateful.
Regards, and Best Wishes for Christmas and the New Year,
Wib