Hi,

I am having some problems to my code. Basically, it should save Word Mail-merge document individually into the designated path.

1) It saves the files with additional blank files which is not supposed to. I am using Word 2007.

2) I want the file name to be the first word in the file but I am unable to do so.

Could you please help modify my codes? Thank you.


PHP Code: 
Option Explicit
 
Sub AllSectionsToSubDoc
()
     
    
Dim x               As Long
    Dim Sections        
As Long
    Dim Doc             
As Document
     
    Application
.ScreenUpdating False
    Application
.DisplayAlerts False
     
    Set Doc 
ActiveDocument
    Sections 
Doc.Sections.Count
    
For Sections 1 To 1 Step -1
        Doc
.Sections(x).Range.Copy
        Documents
.Add
        ActiveDocument
.Range.Paste
        ActiveDocument
.SaveAs (Doc.Path "C:\Users\Apple\Desktop\Test\" & x & ".doc")
        ActiveDocument.Close False
    Next x
     
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
     
End Sub