Home > Enterprise >  MS Access VBA / Formatting emails w/ MS Word template vs. using code
MS Access VBA / Formatting emails w/ MS Word template vs. using code

Time:11-11

I'd like to use an MS Word template to format emails for a mail merge. I currently use MS Access / VBA / MS Outlook to generate emails, but all of the formatting I'm looking for I hardcode (e.g. {b}, {i}, {u}, {br /}, etc.) Is there a way to use an existing MS Word template to create the body of my email, and allow me to enter data in merge fields.

I don't know how to integrate an MS Word template into my VBA code to generate emails in MS Outlook.

CodePudding user response:

You can save a draft email with placeholders as a template on the disk. When required, you can create a new item based on the Outlook template item and then replace placeholders in the message body with the data required. Use the HTMLBody property of Outlook items which represents the message body.

Read more about that in the article which I wrote for the technical blog - How To: Create a new Outlook message based on a template.

CodePudding user response:

You can also save a html page/template in a richtext memo field and use the replace() function to fill your merge fields, no ms word needed.

  • Related