I found a VB macro script that allows the user to split out and save the files created by mail merge in ms word. Unfortunately it is written for the windows version 2003 - 2007. I am trying to do the same with word for mac 2004. Can some body please take a look at the following macro and see if there is a way to convert it to either a applescript or a word for mac macro.
I found it here:
http://www.gmayor.com/individual_merge_letters.htm
“Split the single merged document into separate letters.”
Having merged to a single document, it is still possible to split to separate documents, with the use of a macro. To this end Doug Robbins also came up with the following, to which I have taken the liberty of making a couple of small changes.
The macro splits the document and files each sub document into the indicated path - shown here in blue. The files are named by date and sequence number, with the date format from the mask - also shown in blue. Both these variables can easily be changed to reflect personal preferences - nor should it be too difficult for those with vba programming skills and inclination to modify the code to prompt for a name and/or path.
Sub Splitter()
’ splitter Macro
’ Macro created 16-08-98 by Doug Robbins to save each letter created by a
’ mailmerge as a separate file.
’ With minor modifications by Graham Mayor 10-02-03
Dim mask As String
Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
mask = “ddMMyy”
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
DocName = "D:\My Documents\Temp\Workgroup" & Format(Date, mask) _
& " " & LTrim$(Str$(Counter)) & “.doc”
ActiveDocument.Sections.First.Range.Cut
Documents.add
With Selection
.Paste
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
End With
ActiveDocument.SaveAs FileName:=DocName, FileFormat:=wdFormatDocument
ActiveWindow.Close
Counter = Counter + 1
Wend
End Sub
As an alternative, the following macro provides the opportunity to provide the fixed portion of the filename and to change the path of the saved files:
Sub SplitMerge()
’ splitter Macro
’ Macro created 16-08-98 by Doug Robbins to save each letter created by a
’ mailmerge as a separate file.
’ with modifications by Graham Mayor 16-06-03 & 08-10-04
Dim Title As String
Dim Default As String
Dim MyText As String
Dim MyName As Variant
Dim MyPath As String
Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
Selection.HomeKey Unit:=wdStory
Counter = 1
Default = “Merged”
MyText = “Enter a filename. Long filenames may be used.”
Title = “File Name”
MyName = InputBox(MyText, Title, Default)
If MyName = “” Then
End
End If
Default = "D:\My Documents\Test"
Title = “Path”
MyText = “Enter path”
MyPath = InputBox(MyText, Title, Default)
If MyPath = “” Then
End
End If
While Counter < Letters
Application.ScreenUpdating = False
Docname = MyPath & LTrim$(Str$(Counter)) & " " & MyName & “.doc”
ActiveDocument.Sections.First.Range.Cut
Documents.Add
With Selection
.Paste
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
End With
ActiveDocument.SaveAs FileName:=Docname, FileFormat:=wdFormatDocument
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend
End Sub
thanks
Hassan