Help with MarkEntry method?

G

Geoff C

I'm using an index as an automatic glossary (a tip picked up from another
discussion group), and wanted a macro to simpify adding new entries. I've
got this far

Sub MarkGlossaryEntry()
If Selection.Type = wdSelectionNormal Then
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
Entry:=Selection.Range.Text, CrossReference:= ????? , Italic:=False
End If
End Sub

How do I get the macro to prompt the user to insert a text string that can
be used for the cross-reference? Apologies if this is easy, I'm not familiar
with Word VBA yet.
Geoff.
 
G

Greg Maxey

Something like this:

Sub MarkGlossaryEntry()
Dim oText As String
oText = InputBox("Type a cross reference")
If Selection.Type = wdSelectionNormal Then
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
Entry:=Selection.Range.Text, CrossReference:=oText,
Italic:=False
End If
End Sub
 

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