Knoth23
Knoth23

Reputation: 235

Splitting Word documents with VBA

I have a Word document that starts with a Table of Contents. I need to break up the document into sections based on the Table of Contents. The Table of Contents has a section title and section number.

How can I use VBA to split the document based on the section numbers/ name?

Upvotes: 1

Views: 1267

Answers (1)

Ken Paul
Ken Paul

Reputation: 5765

If these truly are Sections in the Word sense, then you can access the Sections collection in the ActiveDocument object. Each Section can then be copied to a new document and saved. If your sections are actually header levels or something similar, your macro can search for the heading style for the correct heading level, select the section under the heading, and save the selection to a new document as above.

Upvotes: 0

Related Questions