I'm making this 2nd post of an earlier question, as I have more information and a better sample to attach.
In the sample Word doc I have Heading 1, 2 and 3. The code in Module1 will find each Heading in sequence. This works for Heading 1 and 2, but not Heading 3.
I found that the reason is the existence of the table within the text below the Heading 3.
It turns out that the problem occurs ONLY
when the table is directly
below the Heading.
I have attached a sample doc.HM-sample-for-EE2.docm
To see what I mean:
Run the code in Module1 by stepping through (F8).
See that it finds the first Heading 3. On the next time round the loop the code should select the next Heading 3. But instead it finds the same one.
This is because there is a table immediately below the Heading.
To test this, enter a line of text below the Heading. This time it will work.
To test further, change the find criterion to 'Heading 1' or 'Heading 2'. It will work.
What is it that the doc has got that prevents Find from working as it should?
(Note: Martin, thanks for your valuable advice on coding. I shall apply them in future, although I haven't modified this sample)