Email current record to Outlook in rich text format issue.

dmacias

Registered User.
Local time
Today, 06:53
Joined
Aug 16, 2016
Messages
11
My name is David. I work for Discover Financial. I have about 2 1/2 years working with Access 2010-2013.

I've met my share of road blocks and stumpers but for the most part have figured things out on my own and via other online resources. However, I am really stumped now.

In a nutshell, I am working with an Access form. I've created a button that will email the current record DATA the user is looking at to Outlook. I've managed to do this using VBA except the email that will be outgoing does not appear as rich text format. If the user wants to add or revise font color or size a bit before sending out, they can't because things are grayed out. Here is the coding I'm using, what am I missing or doing wrong??



Private Sub cmdSendEMail1_Enter()
On Error Resume Next


Dim strTo As String
Dim strCC As String
Dim strBCC As String
Dim strSubject As String
Dim strMessageBody As String


strTo = DLookup("[Requester]", "tblFixedEMail")
strCC = "dmac AT helpme DOT com; dmac AT cantfigureitout DOT com;" & DLookup("[PS_Email]", "tblFixedEMail")
strBCC = DLookup("[FixedBCC]", "tblFixedEMail")
strSubject = DLookup("[VM R1]", "tblFixedEMail") & " - " & DLookup("[Corporate_Supplier Name]", "tblFixedEMail") & " - " & DLookup("[Relationship Name]", "tblFixedEMail") & ": " & "Moderate - In Scope for a PSVR Assessment - BU Action Needed"
strMessageBody = "<---This is an automatically generated email. Please do not respond.---->"


DoCmd.SendObject acSendNoObject, acFormatRTF, , strTo, strCC, strBCC, strSubject, strMessageBody


If Err = 2501 Then Err.Clear


End Sub

======================

I do want to mention that when I remove the "strMessageBody" for that last "DoCmd.SendObject" command line, the email DOES populate as rich text format.......it's only when I add "strMessageBody" back to the line that it doesn't take....things go back to being grayed out again. I've also noticed that my signature block does not auto-populate at the bottom of the body of the email in either scenario as it usually does when normally creating a new email in Outlook.

(BTW, I am aware that users have the ability to change the format from text to rich once they ARE in Outlook...... but would be great to have to bypass those one or two steps. Not lazy....just hate when I'm stumped!!!) ;-)

Any assistance would be GREATLY appreciated thank you!

DM
 
Last edited:
You may not be able to do that via DoCmd.SendObject but maybe you can do what you want through Outlook Automation. Below is some code I found in this Web page which looks like it might be a good start.

Code:
Dim olApp As Object
Dim olMail As Object
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(0)
With olMail
.To = "toaddress@company.com"
.Subject = "Subject Line"
.HTMLBody = "<p>This is the first line.</p><p>This is the second line.</p>"
.Display
End With
Set olMail = Nothing
Set olApp = Nothing
 
Thanks for the response sneuberg.

Really bugging me. Why would rich text be there when it comes to To, CC, BCC and Subject.....but not be there for the content you want in the body of the email???

:banghead:




You may not be able to do that via DoCmd.SendObject but maybe you can do what you want through Outlook Automation. Below is some code I found in "http.....html which looks like it might be a good start.

Code:
Dim olApp As Object
Dim olMail As Object
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(0)
With olMail
.To = "toaddress@company.com"
.Subject = "Subject Line"
.HTMLBody = "<p>This is the first line.</p><p>This is the second line.</p>"
.Display
End With
Set olMail = Nothing
Set olApp = Nothing
 
Thanks for the response sneuberg.

Really bugging me. Why would rich text be there when it comes to To, CC, BCC and Subject.....but not be there for the content you want in the body of the email???

:banghead:
It's not really there for To, CC, BCC and Subject. At least not in my Office 2013. If I click on a New Mail to start a new email the formatting icons are disable for these fields and only become enabled when the body has focus.

It's too bad the DoCmd.SendObject doesn't have a option to specific that the body is HTML. If your body was actually coming from a RTF field it would need to accept HTML for the formatting to be preserved, i.e., the format of Access RTF fields is actually HTML.
 

Users who are viewing this thread

Back
Top Bottom