The code itself goes in the same module as the rest of your code.
The code is a function to be called from your main process. e.g. after say NextPara has been declared you can use it to check what the paragraph level number is.
To test it put the cursor in a paragraph and run the following macro from the same module as the function
Code:
Sub Test()
Dim para As Paragraph
Set para = Selection.Paragraphs(1)
MsgBox ListParaNum(para)
End Sub
You can use the number so obtained to determine what the next or previous paragraph is.