Hello,
I have found a code that opens Outlook, adds the email address in the To line and a text in the subject line.
I would like to place this code behind a button on a form. I was wandering if there is a way to include the value of certain controls on the form (ex. txtFname, txtLName) in the body of the email. This is the code:
" Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Set the Subject, Body, and Importance of the message.
.Subject = "Test"
.Body = "Hello."
.To = "xxx@yahoo.com; xxx@gmail.com"
.Display
End With
Set objOutlook = Nothing
End Sub "
Thank you for your help.
I have found a code that opens Outlook, adds the email address in the To line and a text in the subject line.
I would like to place this code behind a button on a form. I was wandering if there is a way to include the value of certain controls on the form (ex. txtFname, txtLName) in the body of the email. This is the code:
" Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Set the Subject, Body, and Importance of the message.
.Subject = "Test"
.Body = "Hello."
.To = "xxx@yahoo.com; xxx@gmail.com"
.Display
End With
Set objOutlook = Nothing
End Sub "
Thank you for your help.