I have given myself a headache trying to work out the various combinations without much success.
The following function will give you the outline level number for a selected paragraph, which should help work out what the previous and following paragraphs are:
Code:
Private Function ListParaNum(oPara As Paragraph) As String
Dim i As Integer
Dim xRefs As Variant
xRefs = ActiveDocument.GetCrossReferenceItems(wdRefTypeNumberedItem)
ListParaNum = 0
With oPara.Range
If .ListParagraphs.Count = 0 Then
GoTo lbl_Exit
End If
.Collapse wdCollapseEnd
On Error Resume Next
For i = 1 To UBound(xRefs)
If ActiveDocument.ListParagraphs(i).Range.End = .End Then
ListParaNum = Val(ActiveDocument.ListParagraphs(i).Range.ListFormat.ListString)
Exit For
End If
Next i
End With
lbl_Exit:
Exit Function
End Function