but that special character still shows up in the index when I insert the index at the end.
thanks
you also did not respond to this
===================
This is your first code I would like to use, but there is a problem here
Application.ScreenUpdating = False
ActiveWindow.View.ShowFieldCodes = True
With Selection
ActiveDocument.Indexes.MarkEntry Range:=.Range, _
Entry:=.Text, EntryAutoText:=.Text, Bold:=False, Italic:=False
With .Fields(1).Code
.Collapse wdCollapseEnd
.Fields.Add Range:=.Duplicate, Type:=wdFieldEmpty, _
PreserveFormatting:=False, _
Text:="STYLEREF ""Default Paragraph Font"" \n"
End With
End With
ActiveWindow.View.ShowFieldCodes = False
Application.ScreenUpdating = True
when I stepped to it, it crashed in this line
With .Fields(1).Code
the problem is the selected text need to have a space at the end. So if Apple end with "," or "." and only apple is selected then the problem. It only works if Apple is selected with an empty space