Word navigate back and forth between outline numbered sub paragraphs

Jonathan 25 Reputation points
2026-08-29T16:23:27.2966667+00:00

I ask this question here as no other help resource correctly answers my problem and I am always directed to using bookmarks, GoTo function and headings

I have a complex legal document 74 pages long, paras are not numbered using Outline number, but numbered with levels e.g, Section 7 will be numbered 7.1 to 7.16, where e.g 7.2 has sub paras 7.2.1, to 7.2.12. Similar for every other main level.

As the document is prepared for legal review, numerous edits and alterations are needed as new evidence comes to light which may require changes throughout the document. I have to go back and forth between 2 or 3 paras and sub paras to make edits

GoTo will only allow selection of headings/lines/bookmarks/page etc, . So I can go to para 7, but not 7.2 or any sub level - 7.2 may be 3 pages distant from 7, scrolling back and forth is frustrating and time consuming.

I have tried various macros, none work as needed, the one below will only take me to the first para number it finds matching the whole number, not any sub with decimal point.

Please can anyone help

Sub GoToPara()

'

' GoToPara Macro

'Sub ScratchMacro()

'A basic Word macro coded by Greg Maxey

Dim oPar As Paragraph

Dim lngNum As Long

lngNum = InputBox("Enter the numbered paragraph", "GOTO", 1)

For Each oPar In ActiveDocument.Range.Paragraphs

If lngNum = oPar.Range.ListFormat.ListValue Then

  oPar.Range.Select

  Exit For

End If

Next oPar

lbl_Exit:

Exit Sub

End Sub

Microsoft 365 and Office | Word | For home | Windows
0 comments No comments

Answer accepted by question author
Jay Freedman 208.2K Reputation points Volunteer Moderator
2026-08-29T19:02:37.52+00:00

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.

Was this answer helpful?

4 people found this answer helpful.

1 additional answer

Sort by: Newest
  1. Jonathan 25 Reputation points
    2026-08-30T15:26:51.2+00:00

    Got it working, thanks so much, your code reappeared after reboot, I had left 1 dot out, so did a copy all from yours.

    Excellent, Jonathan

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.