Close Oulook after sending emails via vba without outbox getting stuck.

Not open for further replies.


Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I have vba code that sends emails.
does just fine.
Then i want to quit Outlook.

Until in my code I want to close outlook after sending them.
I used this bit of code to rush and execute the send/receive, thinking it would force the outbox stuff to send.
but I keep getting the message "You have unsent emails..." counting down 30 seconds...
Function Item_Open()
Dim strForm As String
Dim objFolder As Folder
Dim objItem As Outlook.MailItem
'Dim objRecip As Recipient
Dim strBcc As String
Dim objMail As Outlook.MailItem
Dim objRecip As Outlook.Recipient
Dim mySyncObjects As Outlook.SyncObjects
Dim syc As Outlook.SyncObject
'strBcc = ""

strForm = "IPM.Note.proposalm"
Set objFolder = _
Set objItem = _
objItem.To = ""
Set objRecip = objItem.Recipients.Add(strBcc)
If objRecip.Resolved Then
objRecip.Type = olBCC ' 3
End If
objItem.Subject = "Proposal Survey. Please Respond."
' objItem.Display
Item_Open = True

' force the emails out of outbox ?
Set mySyncObjects = Application.GetNamespace("MAPI").SyncObjects
Set syc = mySyncObjects("All Accounts")

Sleep (10000)

End Function
Not open for further replies.
Thread starter Similar threads Forum Replies Date
O Outlook 365 - Toolbar - Close all items - missing? Using Outlook 3
K Working with Explorer.Close event Outlook VBA and Custom Forms 3
Diane Poremsky How to Compact the Data File When you Close Outlook New Articles 0
Diane Poremsky Close a Meeting When the Room is Full New Articles 0
L Gmail POP, Android IMAP, Outlook 2013 setup close Using Outlook 5
D help with Item/Inspector close event Outlook VBA and Custom Forms 1
F Automatically close email after selecting mark unread Using Outlook 1
S Pop up reminder while i close outlook Outlook VBA and Custom Forms 5
Y (Shared Folder) Using the preview pane to open and close a fax, without opening the email itself Using Outlook 1
C Open/Close Outlook - Via Excel VBA Using Outlook 2
J OL wont close after VB app runs Using Outlook 17
Q Looking for Outlook 2010 Close Event Id Exchange Server Administration 1
R Can't close Personal Folders after switching to Exchange 2010 Using Outlook 2
R Outlook and google calendar stuck if I close outlook Using Outlook 1
J Messages close themselves - Outlook 2007 Using Outlook 1
P Minimize button causes Outlook to close 2007 Using Outlook 1
D Cannot Close pst file Using Outlook 1
R How do I close Outlook 2010 folders and have messages received unopened? Using Outlook 2
J Microsoft Office Outlook has encountered a problem and needs to close. We are sorry for the inconve Using Outlook 2
P All of a sudden I cannot open the INBOX file. It asks me to close any application and restart. Done that several times. Nothing Using Outlook 1
C Deleted email window won't close Using Outlook 1
B "....pst cannot be accessed because another workstation has modified it. close and then restart all Using Outlook 1
T I have Office Professional 2010 and Microsoft Outlook has stopped working Close the Program__ Using Outlook 2
B Outlook won't reopen once I close it down Using Outlook 3
S Outlook 2010 will not close on exit Using Outlook 5
K Microsoft office outlook has encountered a problem and needs to close. We are sorry for the inconven Using Outlook 3
D Automatically close received email when forwarding r replying Using Outlook 1
B Can not start Microsoft Office Outlook. Errors have been detect in the file. It said, close Outlook Using Outlook 1
F A dialog box is open, close it and try again. Don't see any dialog box open. Using Outlook 5
J Outlook 2007 close but Outlook.exe still running Using Outlook 1
W Microsoft has encountered a problem and needs to close. Using Outlook 3
M office 2007 - office outlook has encountered a problem...needs to close Using Outlook 3
L Can not get Outlook to save e-mail account passwords. If I put passwords in manually system works fine, but when I close Outlook and reopen I have to Using Outlook 1
B E-mail window will not close after message has been sent Using Outlook 3
H get error message on sign off, an unexpected error has occurred. Setup can not continue. Please close and try again. Using Outlook 1
G Office Outlook has encountered a problem and needs to close. Using Outlook 1
J Outlook doesn't close. Cannot open outlook without going to task manager Using Outlook 1
N Send To: Mail Receipient / Send As Email - Window Doesn't Close But Email Sends OK Using Outlook 4
J Outlook (Office 2007 Basic) exits when I close an email or appointment. Using Outlook 2
S How to make Outlook close completely. Using Outlook 2
R Microsoft Office Encountered a Problem and needs to close. Using Outlook 2
J "A data file did not close properly the last time it was used" in Outlook 2007 Using Outlook 3
J Recent emails disappear when I change folders in Outlook. They reappear when I close and re-open Out Using Outlook 6
J Outlook 2010 - Meeting will not close without sending an update Using Outlook 6
W c:\users\anne\appData\local\microsoft\outlook\outlook.pst is in use and cannot be accessed. Close a Using Outlook 4
K The file c:\...\Outlook1.pst cannot be accessed because another workstation has modified it. Close a Using Outlook 2
R Outlook 2003 - Close parent form before opening child form Outlook VBA and Custom Forms 4
D microsoft outlook has stopped working, close program, windows will check for solution Using Outlook 9
S Error 287 on Inspector.Close() Outlook VBA and Custom Forms 4
Similar threads