A family of Microsoft word processing software products for creating web, email, and print documents.
Hi Steve,
Maybe inspiriation has struck. Try:
Sub CrossRefThisListPara()
Application.ScreenUpdating = False
Dim i As Integer, xRefs As Variant
'Get the CrossReferenceItems collection
xRefs = ActiveDocument.GetCrossReferenceItems(wdRefTypeNumberedItem)
With Selection
.Collapse wdCollapseEnd
On Error Resume Next
'Loop through the CrossReferenceItems collection to find the current paragraph
For i = 1 To UBound(xRefs)
If ActiveDocument.ListParagraphs(i).Range.End = .Paragraphs.First.Range.End Then
'Insert a Cross-Reference to the selected paragraph, using the Bookmark ID allocated by Word
.InsertCrossReference ReferenceType:=wdRefTypeNumberedItem, ReferenceKind:=wdNumberFullContext, _
ReferenceItem:=i, InsertAsHyperlink:=True, IncludePosition:=False
Exit For
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Comparing the paragraph end positions, rather than the whole range seems to work. It also obviates the need to insert needless bookmarks for a mass of numbered paragraphs for which there will never be a cross-reference.
Cheers,
macropod MS MVP - Word