Convert 200-page word doc to 200 separate docs

F

funnybroad

I have had a request to take a 200 page word document and convert it into 200 single page documents and save each one separately.

Anybody got a clue on how to go about this, Julie said write a macro which I am trying to work out but it will probably take me a week as my VB knowledge is fairly limited.

Another option was to convert to PDF and use page extraction to separate the files.

But we really want to keep the docs in word format.
 
J

Jonathan West

Hi funnybroad,

A few days ago, Doug Robbins posted the following macro in response to
somebody who wanted to do exactly the same thing (except that their document
was only 30 pages).


Sub splitter()
'
' Macro created 07-09-04 by Doug Robbins to save each page of a document
' as a separate file with the name being the lastword of the first paragraph
' on each page

Dim Pages As Long, Counter As Long, para1 As Range, docname As String
Dim Source As Document, NewDoc As Document
Set Source = ActiveDocument
Selection.HomeKey Unit:=wdStory
Pages = Source.BuiltInDocumentProperties(wdPropertyPages)
Counter = 0
While Counter < Pages
Counter = Counter + 1
Source.Bookmarks("\Page").Range.Cut
Set NewDoc = Documents.Add
NewDoc.Range.Paste
Set para1 = NewDoc.Paragraphs(1).Range
docname = para1.Words(para1.Words.Count - 1)
NewDoc.SaveAs FileName:=docname
NewDoc.Close
Set NewDoc = Nothing
Wend

End Sub

In this particular macro, the filename for each split document is set to the
text of the fist paragraph on the page. This can be changed if necessary.
For instance, if you want the pages simply to be called "page 1.doc", "page
2.doc" etc, change this line of code

docname = para1.Words(para1.Words.Count - 1)


to this

docname = "page " & CStr(Counter)

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

funnybroad said:
I have had a request to take a 200 page word document and convert it into
200 single page documents and save each one separately.
Anybody got a clue on how to go about this, Julie said write a macro which
I am trying to work out but it will probably take me a week as my VB
knowledge is fairly limited.
 

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