Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-19-2016, 12:13 AM
UnlimitedPower UnlimitedPower is offline Filename Windows 7 64bit Filename Office 2010 64bit
Novice
Filename
 
Join Date: Aug 2016
Posts: 1
UnlimitedPower is on a distinguished road
Default 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
I'm a total noob at this but I would like to copy a word from the generated file and paste it in the title. Is this possible?



Kind Regards,
Reply With Quote
  #2  
Old 08-19-2016, 12:22 AM
macropod's Avatar
macropod macropod is offline Filename Windows 7 64bit Filename Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

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
Filename 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
Filename 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft