Need to edge out the competition for your dream job? Train for certifications today.
Dim objOL As Object
Set objOL = CreateObject("Outlook.Application")
Dim email As Object
Set email = objOL.CreateItem(0) '0 = olItemEmail
.To = "firstname.lastname@example.org"
.Subject = "Test email"
.Body = "This is a test email"
.display 'use .Send to send the email immediately
Open in new window
Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
DoCmd.SendObject , , , , , , Trim(Me.FirstName & " " & Me.LastName), "Received documents."
Might review the Trusted Locations to ensure the Access db is located in one.
Just for fun, try sending a report with all the major arguments filled in:..
I tested code, like what I suggested above, in 2016 and it worked fine.
(was this same event code working in the previous version?)
This has nothing to do with the file being an ADP.
Just tested with an A2003 MDB and the same is happening there.
Just curious - what happens if you run that code in a .accdb format file with 2016?
I got to test at another pc with Outlook 2016 and it worked with all versions MDB and ACCDB.
For example, in Access 2016 I can look at the Account page and see that I'm running "Microsoft Office Professional Plus, Version 1710, Built 8625.2127". Compare those
Also, it could be something entirely different - for example, the version of DAO/JET/ACE on each machine
Try temporarily turning off antivirus to see if that is the culprit (long shot, but ya never know).
Thank you for your help, Everyone! I appear to have solved the problem.
I noticed that the access wizards were not working this afternoon (I used a query wizard to start the structure of an SQL statement). That made me think that my copy of Access had somehow become corrupted.
Using the Windows Add/Remove programs feature, I repaired Runtime 2013 and did a quick repair of my copy of Office 365. After that, SendObject commands worked as they had in the past..
Public Sub MySendObject(sTo As String, sSub As String, sCC As String, sBcc As String, ByVal shtmlBody As String)
Dim outApp As Outlook.Application, outMsg As MailItem
Dim itm As Variant
On Error GoTo err
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)
.To = sTo
.CC = sCC
.BCC = sBcc
.Subject = sSub
.Body = shtmlBody
' .htmlBody = shtmlBody
' .ReadReceiptRequested = True
Set outApp = Nothing
Set outMsg = Nothing
Try specifically including the EditMessageargument:
Of course, it's not much use if you don't actually have any HTML-formatted text ...
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.