

Otherwise, it merely creates a new document.
#ADDRESS MAIL MERGE FROM EXCEL TO WORD HOW TO#
Body = Replace(.Body, "", strAcctMgrName)įirst: You need to have macro security set to the lowest setting, Enable all macros during testing. Re: How To Create Custom Word Documents From Excel WITHOUT Mail Merge Mailmerge does NOT send the document anywhere unless you tell it to merge to email or printer. Set olItem = olApp.CreateItemFromTemplate(appdata & "\Microsoft\Templates\macro-test.oft") 'Set olItem = olApp.CreateItem(olMailItem) 'Create Mail Item and view before sending StrAcctMgrName = xlSheet.Range("F" & rCount)ĪcctMgrEmail = xlSheet.Range("G" & rCount) 'strAttachment = strAttachPath & xlSheet.Range("E" & rCount) StrFirstname = xlSheet.Range("A" & rCount) Set olApp = CreateObject("Outlook.Application")ĭo Until Trim(xlSheet.Range("A" & rCount)) = ""

Set olApp = GetObject(, "Outlook.Application") StrAttachPath = enviro & "\Documents\Send\" ' you need to set a reference to Outlook Object Library (Yes, I know, I'm not creative with demo values and prefer to use Excel's features to create demo values.) The finished merge will look like the following. Using unique values allows us to use VBA's Replace function.
#ADDRESS MAIL MERGE FROM EXCEL TO WORD UPDATE#
While you could use standard merge fields or bookmarks, you would need to use the Word Object Library to update the fields. It also sends the message From an address in the worksheet.Ĭreate an Outlook template, entering unique values where the merge fields would be entered. This macro reads values from an Excel worksheet and sends a mail merge, replacing unique values in the Outlook template with values in the worksheet.
