Delete a chapter

R

Ronny

I have a document which I want to automate. Is it possible to delete a
complete chapter in the document by use of VBA?

Ronny
 
G

Graham Mayor

What in your document constitutes a 'chapter'?
If you can identify that 'chapter' to a macro then it can be processed like
any other range.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

Ronny

I identify a chapter as “Heading 1â€. Heading 1 consists of several sub
headings and approx 20 pages. So if it is possible to identify and delete a
“Heading 1†with a given text, and then delete all text that is included
under “heading 1†that would solve my problem.

Could you show me an example of how to do this?

Ronny
 
J

Jonathan West

Ronny said:
I identify a chapter as "Heading 1". Heading 1 consists of several sub
headings and approx 20 pages. So if it is possible to identify and delete
a
"Heading 1" with a given text, and then delete all text that is included
under "heading 1" that would solve my problem.

Could you show me an example of how to do this?

Yes. If you position the cursor in the Heading 1 text, the following line of
code will delete everything down to the next Heading 1

ActiveDocument.Bookmarks("\HeadingLevel").Range.Delete
 
Top