#1
|
|||
|
|||
Filename
Hello,
I'm creating a word document that imports text from a other document trough "Mailings". This generates 1 file with all the data. I use the following code to save each page to 1 file. Code:
Sub BreakOnPage() Application.Browser.Target = wdBrowsePage For i = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages") ActiveDocument.Bookmarks("\page").Range.Copy Documents.Add Selection.Paste Selection.TypeBackspace ChangeFileOpenDirectory "Z:\" DocNum = DocNum + 1 ActiveDocument.SaveAs FileName:="Verslag_" & DocNum & ".doc" ActiveDocument.Close Application.Browser.Next Next i ActiveDocument.Close savechanges:=wdDoNotSaveChanges End Sub Kind Regards, |
#2
|
||||
|
||||
Instead of reinventing the wheel, see:
• Send Mailmerge Output to Individual Files; and • Split Merged Output to Separate Documents in the Mailmerge Tips and Tricks thread at: https://www.msofficeforums.com/mail-...ps-tricks.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Put data from one file to another with certain filename | dapeamel | Excel Programming | 6 | 03-16-2015 09:31 AM |
Part of Filename in header | mthicke | Word | 5 | 02-25-2014 03:54 PM |
Error! Filename not Specified | mark.lacey | Outlook | 0 | 10-12-2011 03:02 AM |
From Office '03 to '10 - where is the Excel filename ??? | TL86 | Excel | 4 | 02-21-2011 08:08 AM |
Filename in footer | Dixon | Word | 3 | 09-24-2009 09:12 AM |