How can I check if email was sent? (1 Viewer)

pepok4

Registered User.
Local time
Today, 14:04
Joined
Jan 10, 2013
Messages
14
Hi all,
I need help with sending email using VBA & HTML. I want send email from access. Message in body contains some text and table in HTML format. I need check if email was really sent or cancelled with user.
Thanks in advance.

Code:
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)

    With objMail
        'Set body format to HTML
        .To = Me.To
        .Subject = Me.Subject
        .BodyFormat = olFormatHTML
        .HTMLBody = "<HTML><BODY>" & sTblBody & " </BODY></HTML>"
        .Display
        
    End With
I need some message (for example):
If error then
MsgBox "Email not sent"
Else
MsgBox "Email sent"
End If
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:04
Joined
Feb 19, 2002
Messages
43,302
You can send the email directly rather than displaying it. There isn't any way to determine if the user actually pushed the send button since that is under the control of Excel. If you wanted to know what emails have been sent, you would need to read through the sent emails collection and match them to what you think should have been sent.
 

Users who are viewing this thread

Top Bottom