P
Pietro
Hi,
I'm using the below code to send an e-mail with attachment through MS
Access,the code is working perfectly.The only problem is that i want to write
more words in the message body in more than one line,but the code writes the
whole text in one line only even after trying to use Chr$(10) to go to a new
line.
Can anybody help?
The code is:
Private Sub Form_Timer()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Dim A As String
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatHTML
.To = [Forms]![mail]![To]
.CC = [Forms]![mail]![CC]
.Subject = [Forms]![mail]![Subject]
.HTMLBody = "Attached is Tier2 Daily Report"
If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
.Attachments.add (Me.Mail_Attachment_Path)
End If
[Forms]![reporter]![data] = Date - 1
[Forms]![reporter]![Agent] = [Forms]![login]![Agent]
DoCmd.Close acForm, "reporter"
DoCmd.Close acForm, "nr"
Application.Echo False
DoCmd.SelectObject acTable, "", True
DoCmd.RunCommand acCmdWindowHide
Application.Echo True
'.DeleteAfterSubmit = True 'This would let Outlook send th
note without storing it in your sent bin
.Send
End With
'MsgBox MailOutLook.Body
Exit Sub
DoCmd.Close acForm, "mail"
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error message
is: " & Err.Description
Resume Error_out
Error_out:
End Sub
I'm using the below code to send an e-mail with attachment through MS
Access,the code is working perfectly.The only problem is that i want to write
more words in the message body in more than one line,but the code writes the
whole text in one line only even after trying to use Chr$(10) to go to a new
line.
Can anybody help?
The code is:
Private Sub Form_Timer()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Dim A As String
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatHTML
.To = [Forms]![mail]![To]
.CC = [Forms]![mail]![CC]
.Subject = [Forms]![mail]![Subject]
.HTMLBody = "Attached is Tier2 Daily Report"
If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
.Attachments.add (Me.Mail_Attachment_Path)
End If
[Forms]![reporter]![data] = Date - 1
[Forms]![reporter]![Agent] = [Forms]![login]![Agent]
DoCmd.Close acForm, "reporter"
DoCmd.Close acForm, "nr"
Application.Echo False
DoCmd.SelectObject acTable, "", True
DoCmd.RunCommand acCmdWindowHide
Application.Echo True
'.DeleteAfterSubmit = True 'This would let Outlook send th
note without storing it in your sent bin
.Send
End With
'MsgBox MailOutLook.Body
Exit Sub
DoCmd.Close acForm, "mail"
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error message
is: " & Err.Description
Resume Error_out
Error_out:
End Sub