Splitting Word documents with VBA

I have a Word document that starts with a Table of Contents. I need to split a document into sections based on a Table of Contents. The table of contents contains the section title and section number.

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

+1


source to share


1 answer


If these are indeed Sections in the Word sense, then you can access the collection of sections in the ActiveDocument object. Then each section can be copied into a new document and saved. If your sections are heading levels or something similar, your macro can look for the heading style for the correct heading level, select the section below the heading, and save the selection to a new document as above.



0


source







All Articles