VBA to tear apart a document...

J

joshuasq

I have several large documents ranging from 50-300 pages; each of which has
been strictly structured with the use of headings.

I was wondering if there was a way I could extract the contents of the
document into separate documents (based on heading).

Ideally, higher level headers (1-5) would create folders and sub-folders and
Heading level 6 would be the basis of the file name, the subordinate text
would compose the document.
(The creation of folders is not necessary but would be nice).

The heading level 6 would also be repeated within the text of the new
document to serve as title.

Additionally, would it be possible for these new documents to be based on a
designated template?

Any help would be appreciated, any code, resources, or web sites would help!

Thank you.
 
H

Helmut Weber

Hi Joshua,

possible in a way, hardly possible in another way.
Sure you can determine what text belongs to what
heading level, create folders and subfolders as
many as you like, dependant on the text found in
paragraphs with a heading style.

You might find this handy:

Selection.GoTo _
What:=wdGoToHeading, _
Which:=wdGoToFirst, _
Count:=2, _
Name:=""

Also to select the text belonging to that heading:

Selection.Bookmarks("\headinglevel").Select

Sure possible to create new blank docs based
on templates depending on some info in your actual doc.

Nice little project, but first you got to
cut it all down in smaller pieces!

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
J

joshuasq

I suppose there were a few caveats within my request that needed to be
addressed in steps as you suggest.

The need for folders and the need to base the new documents on a
predetermined template are both "luxuries". The main thing I am trying to
accomplish is to take Heading6 and the subordinate text and make a new
document.

I appreciate your input.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top