Hi Brock,
Quote:
This creates a three level index based on the values of the three fields.
|
OK, but if you know the fields' bookmark names, or at least their relative position in the document, you can get the values without and Find/Replace code. For example:
Code:
Sub Demo()
Dim strTmp As String
With ActiveDocument
strTmp = .FormFields(1).Result
strTmp = strTmp & ":" & .FormFields(2).Result
strTmp = strTmp & ":" & .FormFields(3).Result
.Indexes.MarkEntry Range:=.Bookmarks("IndexThis").Range, _
Entry:=strTmp, CrossReference:="", CrossReferenceAutoText:="", _
BookmarkName:="", Bold:=False, Italic:=False
End With
End Sub
If you know the formfield bookmark names, you can replace the 1, 2 & 3 with those. This provides an added level of flexibility. Note too that I haven't had to select anything.
PS: When posting code, please use code tags.