How to get Access to open Outlook in HTML instead of Plain Text (1 Viewer)

WalbergB

New member
Local time
Yesterday, 20:56
Joined
Nov 21, 2024
Messages
2
I have a simple, 2-table database for a small non-profit that keeps track of donors (tblDonor) and their donations (tblDonation). Using the DoCmd.SendObject command, I have Access open Outlook with the TO and SUBJECT lines filled in from the database and the donor's tax receipt attached. I add a note and send the email. This is a portion of the VBA code:

-----------------------------------
'Emails or prints receipt
Dim continue As Integer
continue = MsgBox("Check receipt details before proceeding.", vbOKCancel, "Donor's tax receipt")
If continue = vbOK Then

If Not IsNull(Forms!frmDonorDonation!EmailAddress) Then
DoCmd.SendObject acSendReport, "rptTaxReceipt", acFormatPDF, Forms!frmDonorDonation!EmailAddress, , "bwccr1955@gmail.com", "Tax Receipt Attached"
Else
DoCmd.RunCommand acCmdPrint
End If

Else
Exit Sub

End If

---------------------------

The problem is that Access opens Outlook in Plain Text format. I would prefer HTML format because I have a signature that includes the non-profit's logo. I have Outlook's " Compose messages" set for HTML format, so that's not the problem. When I Googled this problem, I get a solution that involes a massive amount of VBA code that doesn't use the DoCmd.SendObject command. Don't be overly impressed by my use of VBA code above. I adapted that code from a YouTube video on the subject. I'm hoping there is a simple line or two of code that I can add to the above to tell Outlook to open an new message in HTML text format. Can someone help?
 
use Outlook Automation instead of Docmd.SendObject.
 
To SLIGHTLY expand what arnelgp said, using DoCmd.SendObject uses a minimalist approach, a "lowest common denominator" approach, to mail. That is because it has to work with whatever mail client you have. Not everyone uses Outlook.

If you specifically want to control Outlook in detail, you have to read up on "Application Objects" and then create an Outlook Application Object, for which you have highly detailed control over how you build and display your messages. A little bit of a learning curve is involved, but it is not an impossible thing to learn.
 

Users who are viewing this thread

Back
Top Bottom