Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split document into many files Word 2003

Status
Not open for further replies.

ReillyC

MIS
Feb 6, 2004
114
US
I need help badly.Someone in the Office forum suggested I post here. Thanks
I have a word document that is 357 pages. Within the document there are several file groups about 200.

For example,
File2369933 on pages 1 - 3
File9663339 on page 4
File2173993 on pages 5-9

I need to separate each file group into it's own document.
For example,
File2369933.doc
File9663339.doc
File2173993.doc

The file group names appear in the header of each page. Can someone help with a macro?

I found a Separate File by Page macro on the Microsoft website but I'm not sure how to adjust it for my needs.

The following macro copies text one page at a time and saves that text in a new document. The macro uses the pre-defined bookmark "\page" and the document's built-in property of "number of pages".

Sub BreakOnPage()
' Used to set criteria for moving through the document by page.
Application.Browser.Target = wdBrowsePage

For i = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages")

'Select and copy the text to the clipboard.
ActiveDocument.Bookmarks("\page").Range.Copy

' Open new document to paste the content of the clipboard into.
Documents.Add
Selection.Paste
' Removes the break that is copied at the end of the page, if any.
Selection.TypeBackspace
ChangeFileOpenDirectory "C:\"
DocNum = DocNum + 1
ActiveDocument.SaveAs FileName:="test_" & DocNum & ".doc"
ActiveDocument.Close

' Move the selection to the next page in the document.
Application.Browser.Next
Next i
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub

Many thanks
 
First off, "file group" is completely irrelevant to Word. If it is in one document, then it is one document. Word has absolutely no way of making any sense out of "file group".

1. You state the file group is text in the header. This is important - how are the group set apart from each other? Is it by section?

2. Do ANY of the sections (assuming it IS by section) have page setup for differnt headers first page, different headers Odd/Even?

3. What other text is in the header? Is it just something like "File2369933".

Doing this page by page is inefficient, especially if the purpose is to extract new documents that cover more than one page.

The best thing would be to pull up the whole chunk that needs to go to a new document. This can be done. But I need to know the answers to above questions.

Gerry
 
First off, "file group" is completely irrelevant to Word. If it is in one document, then it is one document. Word has absolutely no way of making any sense out of "file group".

Yes. you are correct it is in one document.

1. You state the file group is text in the header. This is important - how are the group set apart from each other? Is it by section? Just page breaks

2. Do ANY of the sections (assuming it IS by section) have page setup for differnt headers first page, different headers Odd/Even?

Unforunately no.

3. What other text is in the header? Is it just something like "File2369933". Yes, only "File2369933" appears in the header.

The text (File2369933)also appears in the top left of the first page of each new file group.

For example,The text reads Patent Family File2369933 (The data appears on pages 1-3) but the text File2369933 only appears on page 1.

Doing this page by page is inefficient, especially if the purpose is to extract new documents that cover more than one page.

The best thing would be to pull up the whole chunk that needs to go to a new document. This can be done. But I need to know the answers to above questions.

I hope I have answered your questions.

Thank You
 
3. What other text is in the header? Is it just something like "File2369933". Yes, only "File2369933" appears in the header.

The text (File2369933)also appears in the top left of the first page of each new file group.

For example,The text reads Patent Family File2369933 (The data appears on pages 1-3) but the text File2369933 only appears on page 1.

Uh...I am confused. I don't care what is in the body text - what is in the HEADER? You state "for example, the text reads Patent Family File2369933". WHAT text? This is text in the document body itself, or text in the HEADER?

I need to know what is in the headers. So lets walk it through page by page. Again, I don't care what is in the body, just the header.

Page 1 "File2369933 "
Page 2 blank
Page 3 blank

Is this correct? If it IS correct, then you absolutely have Page Setup configured for Different first page.

Further, if the header changes by "file group" (and I wish you would refer to this, as it IS irrelevant), thenin fact, you DO have Section breaks. The header text can only change in a document by two ways.

1. Different first page or Different Odd/even

2. Different sections.

Headers are a part of Sections.

Gerry
 
Only the text "File2369933" appears in the header.
2. It has different sections.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top