I think you are confused about how the CollapsedState command works. You apply that command to the heading and it will collapse all of the lower level paragraphs under it. So you don't actually need to loop anything if you only want to collapse to the preceding heading.
Code:
Sub CollapseOutlinesWithinHeading()
'Go to preceding heading and collapse it
Dim rngHeading As Range
Set rngHeading = Selection.GoTo(What:=wdGoToHeading, Which:=wdGoToPrevious)
rngHeading.Paragraphs(1).CollapsedState = True
End Sub