Norbert-
Surely there's a way to examine the Sent Items folder if you have automation set up. You might need to check the folder, then if not there, go into a 2 second wait loop, then check again. Give up after a reasonable time like 10 seconds.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Aug 7, 2015, at 3:07 PM, drnorbert@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Bill,
I am looking now to switch to vbMAPI.
The following is an update of the code:
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
'.SendUsingAccount = OutApp.Session.Accounts.Item(2) '2nd email
.SentOnBehalfOfName = "drChiche@hotmail.com" 'Jim Wagner
.Attachments.Add strPDF 'attachments
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I am still searching for a flag from Oulook 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)
I am looking now to switch to vbMAPI.
The following is an update of the code:
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
'.SendUsingAccount = OutApp.Session.Accounts.Item(2) '2nd email
.SentOnBehalfOfName = "drChiche@hotmail.com" 'Jim Wagner
.Attachments.Add strPDF 'attachments
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I am still searching for a flag from Oulook 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)
__._,_.___
Posted by: John Viescas <johnv@msn.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (10) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar