I
Ian
Using Word97.
In a document I need to find the first "Heading 1" line containing a
known string. Having found that line, I then need to delete it and all
the remaining lines in the document.
For example, if the search string is "123", and the document looks like
this (line numbers on the left):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 This is a para of normal style text containing the
2 string 123, but I want to ignore this para because
3 the 123 is not in a heading 1.
4 PROCEDURE 123 (in Heading 1 style)
5 More normal text under the heading.
6 And even more (end of document).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this example, I want to delete lines 4, 5 and 6 (but not lines 2 or
3, even though they also contain the search string).
I have no prior knowledge of what is in the document. All I know for
certain is that somewhere there will a Heading 1 line containing the
search string.
Can someone point me in the right VBA direction please.
In a document I need to find the first "Heading 1" line containing a
known string. Having found that line, I then need to delete it and all
the remaining lines in the document.
For example, if the search string is "123", and the document looks like
this (line numbers on the left):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 This is a para of normal style text containing the
2 string 123, but I want to ignore this para because
3 the 123 is not in a heading 1.
4 PROCEDURE 123 (in Heading 1 style)
5 More normal text under the heading.
6 And even more (end of document).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this example, I want to delete lines 4, 5 and 6 (but not lines 2 or
3, even though they also contain the search string).
I have no prior knowledge of what is in the document. All I know for
certain is that somewhere there will a Heading 1 line containing the
search string.
Can someone point me in the right VBA direction please.