A family of Microsoft word processing software products for creating web, email, and print documents.
The problem with the macro is the use of ListValue in the comparison, which returns only a single number (a Long data type). Also, the variable lngNum is a Long data type so it can be compared to the ListValue, so it too can contain only a single number.
The solution is to replace the ListValue property with the ListString property. That returns the entire list number as a string (for instance, "3.1.2" or, if your multilevel list is defined with a trailing dot, "3.1.2."). This also requires replacing "lngNum As Long" with "strNum As String". The revised code is this...
Sub GoToPara()
'
' GoToPara Macro
'A basic Word macro coded by Greg Maxey
'modified by Jay Freedman
Dim oPar As Paragraph
Dim strNum As String
strNum = InputBox("Enter the numbered paragraph", "GOTO", 1)
For Each oPar In ActiveDocument.Range.Paragraphs
If strNum = oPar.Range.ListFormat.ListString Then
oPar.Range.Select
Selection.Collapse
Exit For
End If
Next oPar
lbl_Exit:
Exit Sub
End Sub
Remember, if your paragraph numbers end with a dot, you must include that dot in the entry you make in the InputBox or else there won't be any match.
I added one more statement, Selection.Collapse, so the cursor will appear at the first word of the selected paragraph rather than leaving the entire paragraph selected.