I think this would be faster and more comprehensive:
Code:
Sub GetHeadings()
Dim oDoc As Document: Set oDoc = ActiveDocument
Dim varHeadings As Variant, lngIndex As Long
Dim oRng As Word.Range
varHeadings = oDoc.GetCrossReferenceItems(wdRefTypeHeading)
Set oRng = oDoc.Range
For lngIndex = 1 To UBound(varHeadings)
With oRng.Find
.Text = Trim$(varHeadings(lngIndex))
.Forward = True
If .Execute Then
If Left(oRng.Paragraphs(1).Range.Style, Len("Heading")) = "Heading" Then
MsgBox varHeadings(lngIndex) & " auf Seite:" & oRng.Information(wdActiveEndAdjustedPageNumber), vbOKOnly
End If
oRng.Collapse wdCollapseEnd
End If
End With
Next
lbl_Exit:
Exit Sub
End Sub