#1
|
|||
|
|||
Auto-populate key fields in an email?
Hi guys,
I'm not sure if this is possible but I thought I would ask anyway. Google doesn't point me to anything useful (most likely my search skills to be honest...) I have a few email templates which I use on a regular basis. I am trying to find out if it's possible to auto-populate some of the emails with key information? E.g. "Dear <first name>" becomes "Dear Michael" once I define <First name> to be Michael for that specific email. From there on, anytime <First Name> is referenced in the email, it will be automatically changed to 'Michael'. Is this possible to do on Outlook? Thanks. |
#2
|
||||
|
||||
It is possible if you use a macro to create the message e.g. as follows. Change the name and path of the template as required.
Code:
Sub CreateMessageFromTemplate() Dim olItem As Outlook.MailItem Dim olInsp As Outlook.Inspector Dim wdDoc As Object Dim oRng As Object Dim strName As String strName = InputBox("Enter First Name") Set olItem = Application.CreateItemFromTemplate("C:\Path\Test Message.oft") With olItem Set olInsp = .GetInspector Set wdDoc = olInsp.WordEditor Set oRng = wdDoc.Range With oRng.Find Do While .Execute(FindText:="<First name>") oRng.Text = strName oRng.collapse 0 Loop End With .Display End With lbl_Exit: Set olItem = Nothing Set olInsp = Nothing Set wdDoc = Nothing Set oRng = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error 5941 when running my macro to auto populate fields throughout the word doc | VBAnovice1 | Word VBA | 2 | 05-26-2015 01:35 AM |
Auto populate & auto calculate values from other sections in the same word document | Frantic | Word VBA | 2 | 01-24-2015 04:54 PM |
Populate Word Drop-down list with Excel column then auto fill form fields with Excel data | Faldinio | Word VBA | 7 | 10-19-2014 06:03 AM |
auto populate fields for multiple files w/in folder | jbyrd | Word | 0 | 07-21-2014 07:35 AM |
Auto-populate from form fields | kenelder | Word | 3 | 05-23-2013 07:50 AM |