M
MarMo
Hi,
Don't know if this is the correct group , but i'll give it a try.
This is the code i found (from Blueclaw) on the net to send an email
with attachement.
The strMess comes from a field (text-255) in a table (TblMessages)
1) If i add the strMess to the .HTMLBode tag i get all the text on 1
line and not
in different lines, but the attachment is added correctly.(outside the
body)
2) If i add the strMess to the .Body tag the text is on different
lines , but the attachment is put inside the body at the end of the
bodytext and messing up
the layout.
How can i accomplish a correct bodymessage and a correct attachment in
the email.
Thanks for helping me.
Mario
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = strEMAIL
.Subject = "Monthly invoice overview " & strCLNM & " - " &
intCLNR
.Body = strMess
'.HTMLBody = "<HTML>" & strMess & "</HTML>"
If Left(strEMAILATTACH, 1) <> "<" Then
.Attachments.Add (strEMAILATTACH)
End If
'.DeleteAfterSubmit = True 'This would let Outlook send
th note without storing it in your sent bin
Select Case intSendOption
Case Is = 1
.Send
Case Is = 2
.Display
Case Else
End Select
End With
'MsgBox MailOutLook.Body
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error
message is: " & Err.Description
Resume Error_out
Error_out:
Don't know if this is the correct group , but i'll give it a try.
This is the code i found (from Blueclaw) on the net to send an email
with attachement.
The strMess comes from a field (text-255) in a table (TblMessages)
1) If i add the strMess to the .HTMLBode tag i get all the text on 1
line and not
in different lines, but the attachment is added correctly.(outside the
body)
2) If i add the strMess to the .Body tag the text is on different
lines , but the attachment is put inside the body at the end of the
bodytext and messing up
the layout.
How can i accomplish a correct bodymessage and a correct attachment in
the email.
Thanks for helping me.
Mario
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = strEMAIL
.Subject = "Monthly invoice overview " & strCLNM & " - " &
intCLNR
.Body = strMess
'.HTMLBody = "<HTML>" & strMess & "</HTML>"
If Left(strEMAILATTACH, 1) <> "<" Then
.Attachments.Add (strEMAILATTACH)
End If
'.DeleteAfterSubmit = True 'This would let Outlook send
th note without storing it in your sent bin
Select Case intSendOption
Case Is = 1
.Send
Case Is = 2
.Display
Case Else
End Select
End With
'MsgBox MailOutLook.Body
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error
message is: " & Err.Description
Resume Error_out
Error_out: