View Single Post
 
Old 12-04-2013, 09:23 AM
jtemp57 jtemp57 is offline Windows Vista Office 2007
Novice
 
Join Date: Dec 2013
Posts: 6
jtemp57 is on a distinguished road
Default Code for mail merge to reference saved excel file

I am trying to get a code that will open a data source for mail merge and let you choose which source and path you want at that time. I can get the macro to work referencing a specific path such as Name="C:mydocuments\personal\etc...." but I need one that will let me select from different saved files. Here is what I have currently:


Sub LOTO_PRINT_TAGS()
'
' LOTO_PRINT_TAGS Macro
'
'

Dim sPath As String


ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource sPath
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
End Sub
Reply With Quote