Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-04-2013, 09:23 AM
jtemp57 jtemp57 is offline Code for mail merge to reference saved excel file Windows Vista Code for mail merge to reference saved excel file Office 2007
Novice
Code for mail merge to reference saved excel file
 
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
 

Tags
mail merge, vbs



Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for mail merge to reference saved excel file VB code: populate combobox from columns in Excel file billybeach Outlook 2 04-27-2013 04:38 AM
Mail Merge Code (Default Display) ochiha_ita Mail Merge 3 04-22-2013 04:04 AM
Code for mail merge to reference saved excel file Code to stop as "save as" if the mail merge has not been done tonywatsonmail Mail Merge 4 04-27-2012 01:57 AM
Mail Merge saved to single .pdf treetop Mail Merge 1 08-10-2011 03:28 PM
Mail merge Field Code Manipulation macjnr Mail Merge 0 09-10-2009 11:37 AM

Other Forums: Access Forums

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


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft