G
Guest
I figured out how to have Access send an email, but now, I want to enter some
info into the email from text boxes on the form that has the button that
sends the email. Here's what I want to do:
1. get recipient name from a text box
2. add info from another text box into part of the subject and/or body
(kind of like a concatenate function in Excel)
Here is the code I am using to send the email so far:
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("????????")
objOutlookRecip.Type = olTo
.Subject = "??????????????????????????"
.Body = "?????????????????" & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
For Each objOutlookRecip In .Recipients
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
Thanks ahead of time!!!
Doug
info into the email from text boxes on the form that has the button that
sends the email. Here's what I want to do:
1. get recipient name from a text box
2. add info from another text box into part of the subject and/or body
(kind of like a concatenate function in Excel)
Here is the code I am using to send the email so far:
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("????????")
objOutlookRecip.Type = olTo
.Subject = "??????????????????????????"
.Body = "?????????????????" & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
For Each objOutlookRecip In .Recipients
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
Thanks ahead of time!!!
Doug