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 / May 2006

Tip: Looking for answers? Try searching our database.

Data Extract by page and Save

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Allen - 09 May 2006 21:29 GMT
I was wondering how to approach (and some guidance) on the following dilema.  

I have a Word document that is broken out by geographic region (each page in
the document is it's own regional report, about 150 pagers, -- RTF export
from Crystal Reports).  I need to be able to email each branch just their
data.  

Its been manually hand-stuffed into envelopes in the past and would like to
get away from that, but not sure how to approach this without adding another
level of manual labor by saving each branch's page individually and e mailing
it off.  Automating just the extract of each page and saving as a different
document would be a great start.

Any help on the matter would be greatly appreciated.
Doug Robbins - Word MVP - 10 May 2006 05:07 GMT
The following macro will save each page as a separate document:

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

And, with a bit more work integrating, you could use the information in the
following article to send each document as an attachment to a mailmerge:

"Mail Merge to E-mail with Attachments" at

http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm

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

>I was wondering how to approach (and some guidance) on the following
>dilema.
[quoted text clipped - 16 lines]
>
> Any help on the matter would be greatly appreciated.
 
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.