Add form fields to the msg box of an email

papasmurfuo9

Registered User.
Local time
Today, 06:38
Joined
May 28, 2014
Messages
69
Hi
i have code to open up an email from a form,
what i would like is certain field values of the form to appear in the email

anyone help?
thanks alot
 
What code are you using to open the email? Is it DoCmd.SendObject? If so you can use the MessageText argument to pass the required info. If you are using the Outlook object method, you can use the Body.
 
Hi
thanks for the reply, below is my code
where i have Number: , in the msg body
i want the number to equal the value entered in Fld_Number, label is Txt_Number - not sure which you need

thanks alot

Code:
Dim MyOutlook As Object
Dim MyMail As Object
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.BodyFormat = olFormatHTML
MyMail.Display
Signature = MyMail.HTMLBody
MyMail.To = ""
MyMail.CC = ""
MyMail.Recipients.ResolveAll
MyMail.Subject = " " & Format(Date, "DD/MM/YYYY")

Body = "<html><body><p style=""font-family:arial;color:rgb(65,65,66);font-size:15px;"">"
Body = Body & "Hi All,<br><br>Please can you open the attached account.<b></b><br><br>"
Body = Body & "<tr><td><b><Font Color = ""#461172"">Number: </font></b></td><td>" & "</td></tr><br><br>"


Body = Body & "Many Thanks<b><Font Color = ""#461172"">" & "</font></b>, .<br><br>"

Body = Body & Signature
MyMail.HTMLBody = Body
MyMail.DeleteAfterSubmit = False
MyMail.Display
Set MyOutlook = Nothing
Set MyMail = Nothing
Set MyMail = Nothing
 
Try this code !
Code:
Dim MyOutlook As Object
Dim MyMail As Object
Dim bodyStr As String

Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)

MyMail.BodyFormat = olFormatHTML
MyMail.Display
Signature = MyMail.HTMLBody
MyMail.To = ""
MyMail.CC = ""
MyMail.Recipients.ResolveAll
MyMail.Subject = " " & Format(Date, "DD/MM/YYYY")

bodyStr = "<html>" & _
          "<body>" & _
          "<p style='font-family:arial;color:rgb(65,65,66);font-size:15px;'>"
bodyStr = bodyStr & "Hi All," & _
          "<br><br>Please can you open the attached account.<b></b><br><br>"
bodyStr = bodyStr & "<tr><td><b><Font Color = '#461172'>Number: </font></b></td><td>" & _
          [COLOR=Red][B]Me.Fld_Number & "[/B][/COLOR]</td></tr><br><br>"
bodyStr = bodyStr & "Many Thanks<b><Font Color = ""#461172"">" & "</font></b>, .<br><br>"

bodyStr = bodyStr & Signature
MyMail.HTMLBody = bodyStr
MyMail.DeleteAfterSubmit = False
MyMail.Display

Set MyOutlook = Nothing
Set MyMail = Nothing
Set MyMail = Nothing
 

Users who are viewing this thread

Back
Top Bottom