Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

Saving A multi Page Doc?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lime - 08 Mar 2007 02:41 GMT
Hello,
I have a 93 page doc. I need to save each page as an individual document. Is
there any way to do that without coping and pasting each page? Perhaps with
some code?

Thanks,
Lime
Doug Robbins - Word MVP - 08 Mar 2007 04:39 GMT
Sub splitter()

'

' splitter Macro

' Macro created 16-08-98 by Doug Robbins to save each page of a document

' as a separate file with the name Page#.DOC

'

Dim Counter As Long, Source As Document, Target As Document

Set Source = ActiveDocument

Selection.HomeKey Unit:=wdStory

Pages = Source.BuiltInDocumentProperties(wdPropertyPages)

Counter = 0

While Counter < Pages

   Counter = Counter + 1

   DocName = "Page" & Format(Counter)

   Source.Bookmarks("\Page").Range.Cut

   Set Target = Documents.Add

   Target.Range.Paste

   Target.SaveAs FileName:=DocName

   Target.Close

Wend

End Sub

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hello,
> I have a 93 page doc. I need to save each page as an individual document.
[quoted text clipped - 5 lines]
> Thanks,
> Lime
Lime - 08 Mar 2007 12:06 GMT
Thanks... that works GREAT!!!! :-)

Lime

> Sub splitter()
>
[quoted text clipped - 47 lines]
> > Thanks,
> > Lime
Robert_L_Ross - 12 Mar 2007 20:06 GMT
So Doug...

Is there a way to take the first line of each page and have that be the
document name...or something the code can use to create the document name?

> Sub splitter()
>
[quoted text clipped - 47 lines]
> > Thanks,
> > Lime
Doug Robbins - Word MVP - 19 Mar 2007 22:30 GMT
The following should do it:

Sub splitter()

'

' splitter Macro

' Macro created 16-08-98 by Doug Robbins to save each page of a document

' as a separate file with the name Page#.DOC

'

Dim Counter As Long, Source As Document, Target As Document

Set Source = ActiveDocument

Selection.HomeKey Unit:=wdStory

Pages = Source.BuiltInDocumentProperties(wdPropertyPages)

Counter = 0

While Counter < Pages

   Counter = Counter + 1

   DocName = Source.Bookmarks("\Line").Range)

   Source.Bookmarks("\Page").Range.Cut

   Set Target = Documents.Add

   Target.Range.Paste

   Target.SaveAs FileName:=DocName

   Target.Close

Wend

End Sub

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> So Doug...
>
[quoted text clipped - 53 lines]
>> > Thanks,
>> > Lime
JustALittleHelp - 12 Oct 2007 18:51 GMT
2 part question:

Is this specific to Word 2003 or up? I get an error with the line:
Target.SaveAs FileName:=DocName

I modified the following only:
DocName = "C:\MergedSplit\" & Source.Bookmarks("\Line").Range
(didn't like the right bracket after Range and I'm trying to send it to a
specific path.)

Is there a way to maintain the page setup of the originating document, i.e.,
orientation and margins?

This is so amazingly helpful!
Michele
I apologize if this is redundant.

> The following should do it:
>
[quoted text clipped - 20 lines]
>
> End Sub

> Hope this helps.
>
[quoted text clipped - 60 lines]
> >> > Thanks,
> >> > Lime
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.