Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-26-2009, 02:32 AM
ahmed_tr ahmed_tr is offline individual merge letters Windows 7 individual merge letters Office 2007
Novice
individual merge letters
 
Join Date: Jun 2009
Posts: 2
ahmed_tr is on a distinguished road
Exclamation individual merge letters

First of all
Hi to all members and I am glad that I found a forum that could help me out solve some problems that i face with office.
I just found out by googling a code to separate docs by individual and naming the files from the data source.

the code that i founded is this:

PHP Code:



                        Sub SplitMergeLetter
()
        
' splitter Macro modified to save individual          letters with 
                  ' 
information from          data sourceThe filename data must be added to
                  
' the top of the merge          letter - see web article.
                   
                  Selection.EndKey Unit:=wdStory
        Letters = Selection.Information(wdActiveEndSectionNumber)
        Selection.HomeKey Unit:=wdStory
        Counter = 1
        While Counter < Letters
                     Application.ScreenUpdating = False
                     With Selection
                            .HomeKey Unit:=wdStory
           .EndKey Unit:=wdLine, Extend:=wdExtend
          .MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
                       End With
                     sName = Selection
                     Docname = "D:\My Documents\Test\Merge\" & sName & ".doc"
                      ActiveDocument.Sections.First.Range.Cut
                     Documents.Add
             '
Documents          are based on the Normal template
                               
'To use an alternative template follow the link.
                     With Selection
         .Paste
         .HomeKey Unit:=wdStory
         .MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
         .Delete
             End With
             ActiveDocument.SaveAs FileName:=Docname, _
             FileFormat:=wdFormatDocument
             ActiveWindow.Close
             Counter = Counter + 1
             Application.ScreenUpdating = True
        Wend
        End Sub 
I found the code very useful except the problem that I have is that gives me a blank second page for every doc created.

Any kind of help is appriciated.
Thanks
Reply With Quote
  #2  
Old 06-26-2009, 05:43 PM
zyzzyva57 zyzzyva57 is offline individual merge letters Windows 7 32bit individual merge letters Office 2007
Expert
 
Join Date: Mar 2009
Location: Dawsonville, Ga (NE of Atl)
Posts: 355
zyzzyva57 is on a distinguished road
Default

Not testing out your code, perhaps this might have you noddle out your problem
Reply With Quote
  #3  
Old 06-27-2009, 11:18 AM
ahmed_tr ahmed_tr is offline individual merge letters Windows 7 individual merge letters Office 2007
Novice
individual merge letters
 
Join Date: Jun 2009
Posts: 2
ahmed_tr is on a distinguished road
Default

Quote:
Originally Posted by zyzzyva57 View Post
Not testing out your code, perhaps this might have you noddle out your problem
Thanks
Help me out to solve the problem.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
individual merge letters sending personal letters misteroffice Word 3 12-23-2008 08:51 AM
Stop individual emails from being archived. saltydog85 Outlook 0 07-06-2007 02:13 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:46 PM.


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