-
Monitoring send/recieve
I'm sending mail via excel. I have a reference to the Outlook library.
However, the mail does not send until Outlook is physically opened.
I can open Outlook via my excel sheet
Application.ActivateMicrosoftApp xlMicrosoftMail
but how can i verify(test) if the Send/recieve operation has taken place and thus safely close Outlook and proceed??
-
OK-kind of a fix
[VBA]
Dim objOLapp As Object 'New Outlook.Application
Dim objmailitem As Object 'Outlook.MailItem
'Dim myrecip As Object 'Outlook.Recipient
'dim withevents mysync as outlook.syncobject
Set objOLapp = CreateObject("Outlook.Application")
Set objOLapp = New Outlook.Application
Set objmailitem = objOLapp.CreateItem(olMailItem)
Application.ActivateMicrosoftApp xlMicrosoftMail
'Application.Visible = False
'Application.EnableEvents
With objmailitem
.To = "joe"
.Subject = "Report"
.Attachments.Add "report.xls"
'.Display
.Send
End With
objOLapp.Session.SyncObjects.Item(1).Start
Outlook.Application.Quit
Set objOLapp = Nothing
Set objmailitem = Nothing
Set myrecip = Nothing
[/VBA]
Syncing the object forces the send. Then in exiting, a dialog box remains for 30 seconds, giving enough time for the Send/Receive.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules