Adding mail.(HTML)body from textbox or table

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:
 
M

MarMo

Hi
As i said at the start of my post , i don't know if this is the right
group to post on.
If this is not the correct group ,can someone tell me in which group
to post this question.
I'm trying to figure out the best way to make a HTMLBody from 1 or
more textboxes (linked to a table)
The info is put in by the user to make the mailbody.

Thanks a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top