VBA Flag that would indicate the email was sent from Outlook to Access.

Status
Not open for further replies.

Norbert

New Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
In the following code I need a flag from Outlook 2013 to Access 2013 which will indicate that the email was sent (or at least is in the Outlook Sent Items Folder and not in the Outbox Folder)

Private Sub cmdEmail1_Click()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strbody As String
Dim strPDF As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

strbody = "Dear Aaron," & vbNewLine & "Enclosed is the requested information"
strPDF = Me.txtFile
On Error Resume Next
With OutMail
.To = "drnorbert@msn.com"
.CC = ""
.BCC = ""
.Subject = "Important..."
.Body = strbody
.Recipients.ResolveAll
.SentOnBehalfOfName = "drChiche@hotmail.com"
.Attachments.Add strPDF 'attachments
.Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Thanks
Norbert
 
Status
Not open for further replies.
Top