Formatting Outlook Email in Microsoft Access
Posted on 2014-10-02
I generate an outlook email from MS Access VBA. The body has one line, but now I need to add a list of items on separate lines.
I've tried 2 methods
strBody = "Attached is your quote." & chr(13) & "Equipment" & chr(13) & "Contract Type
strBody = "Attached is your quote." & crlf & "Equipment" & crlf & "Contract Type"
In both methods, the words run together - they are not on a separate line. How can pass line breaks from access to outlook?
Here is my code to send an outlook email from access
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.ISOPEN = True Then 'Already open for mail
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = "Marilyn.Columbos@biomerieux.com"
MailDoc.Subject = Subject
MailDoc.Body = strBody
MailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, recipient