Avatar of suvmitra
suvmitra
Flag for India

asked on 

Format Outlook Mail Messege in Runtime using VBA

Hi,
I am working on sending an automated mail from my MS ACCESS 2003 database application. My VBA code letting me to pull up the outlook template file (Test) and this is fine, I am also able to pull up the other required fields like To, CC etc (Send). Now the problem is I have a variable field called Help Desk Comment and I am also want to insert this field into my Outlook Template.

My question is is it possible to insert additional string / value in runtime into the outlook template file?

I need expert help to clear my idea and get this thing done.

Appreciate your any help on this.  
Public Function SendMyEmail()
Dim db As DAO.Database
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Set MyOutlook = New Outlook.Application
Set db = CurrentDb()
Set MyMail = MyOutlook.CreateItemFromTemplate("\\..\datagrp\Call Tracker\Expenses_Call\TE.oft")
MyMail.SentOnBehalfOfName = "a@a.com"
MyMail.To = Form_frmTemplate.txtTo.Value
MyMail.CC = Form_frmTemplate.txtE_CC.Value
MyMail.Subject = Form_frmTemplate.txtE_sub.Value
MyMail.OriginatorDeliveryReportRequested = False
MyMail.ReadReceiptRequested = False
MyMail.Display
End Function

Open in new window

SendMail.JPG
TestMail.JPG
Microsoft Access

Avatar of undefined
Last Comment
suvmitra

8/22/2022 - Mon