Mail Merge & save as individual file names

kristabelle

New Member
Joined
Apr 14, 2002
Messages
4
I have a mail merge document in Word that is pulling data from an Excel worksheet for about 200 unique items. Thru the merge I am trying to create a new document (in Word), save as a new name and move down the records in Excel to create and save as the next record. I would like to do this for each individual record (create & save).

My trouble is that the mail merge creates one big file and saves it as a single file. I have code that I am trying to make work (somehow) to get it to see the individual id's in the excel range that I am merging but I am stuck.

If anyone is familiar with mail merging to create individually saved documents from the master merge record, preferrably with the individual record number as the saved filename, PLEASE let me know.

The code I'm working with is as follows:

Sub SavePart2()
Dim sName As String
Dim sFirstPart As String
Dim sSecondPart As String
sFirstPart "D:filename"
Dim I As Integer

Documents.Open FileName:="path", ConfirmConversions:= _
False, ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
For I = 1 To wdDefaultLastRecord
.FirstRecord = I
.LastRecord = I
sSecondPart = .DataFields.Count(0).Value & "03"
sName=sFirstPart & sSecondPart
ActiveDocument.SaveAs FileName:=sName, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
.Execute Pause:=True
End With
End With
Next

End Sub

-KB
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi

i would not merge in word, im becomming frieds wit hword i have used this week but would suggest

vba casse times different senerios and have ss to these templates cells kink whats th efiked in word and save on the trim.. this wil allow table array to excel/merge and save on te fly each SS eaqch doc, which is what yoy want...

if you understand that post you be able to do thai alone else let me know ill post my code and advise to do this.


funny ive offered this b4 no one seems to lie excel doing merges.. amy reason?
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top