Hello,
I would like your help about a code wich sent a E-mail.
I would like to insert in the body of my e-mail, a table from access like this.
I have do this to sent the message but i don't know how can i insert in the body a query.
Private Sub cmdSendEmail()
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objMsg As Outlook.MailItem
Dim objRecipient As Outlook.Recipient
Dim objMailAttachment As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
Set objMsg = objOutlook.CreateItem(olMailItem)
With objMsg
.To = "Hello@Access.com"
.Subject = "subject of e-mail"
.Body = "Hello, have a nice day everybody" <-- How can i do ?
.send
End With
Set objOutlook = Nothing
Set objMsg = Nothing
Set objRecipient = Nothing
Set objMailAttachment = Nothing
Error_Handler:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail" & _
"addresses to send your message. "
End If
End Sub
Thanks for your help
Keawee
I would like your help about a code wich sent a E-mail.
I would like to insert in the body of my e-mail, a table from access like this.
I have do this to sent the message but i don't know how can i insert in the body a query.
Private Sub cmdSendEmail()
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objMsg As Outlook.MailItem
Dim objRecipient As Outlook.Recipient
Dim objMailAttachment As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
Set objMsg = objOutlook.CreateItem(olMailItem)
With objMsg
.To = "Hello@Access.com"
.Subject = "subject of e-mail"
.Body = "Hello, have a nice day everybody" <-- How can i do ?
.send
End With
Set objOutlook = Nothing
Set objMsg = Nothing
Set objRecipient = Nothing
Set objMailAttachment = Nothing
Error_Handler:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail" & _
"addresses to send your message. "
End If
End Sub
Thanks for your help
Keawee