Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-20-2015, 06:51 AM
ryebanana ryebanana is offline Auto-populate key fields in an email? Windows 7 64bit Auto-populate key fields in an email? Office 2010 64bit
Novice
Auto-populate key fields in an email?
 
Join Date: Jul 2015
Posts: 1
ryebanana is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 07-21-2015, 04:25 AM
gmayor's Avatar
gmayor gmayor is offline Auto-populate key fields in an email? Windows 7 64bit Auto-populate key fields in an email? Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
Reply



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 key fields in an email? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:06 AM.


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