A visitor to our OutlookForums site wanted to know if he could create a button for an account:
Is it possible to create a toolbar button that would execute Send/Receive on one specific mail account only? I have send/receive groups, and the pull-down button for all accounts from the toolbar, but that involves some menu-wading.
While there are workable options for easier access that don't involve using VBA, you can use Outlook's SyncObjects property in a macro to trigger a send and receive for a specific Send/Receive Group or Account.
This sample does a send and receive on a specific send and receive group. To use, replace the 1 in mySyncObjects(1) with the desired group's position number.
Alternately, you could use the Group's name mySyncObjects("New Group")
Send and Receive Group macro
To use, open the VBA Editor using Alt+F11 and paste this code in either ThisOutlookSession or a Module. Assign it to a toolbar, ribbon, or QAT button to run it.
Public Sub SendReceiveGroup() Dim mySyncObjects As Outlook.SyncObjects Dim syc As Outlook.SyncObject Set mySyncObjects = Application.GetNamespace("MAPI").SyncObjects Set syc = mySyncObjects(1) syc.Start End Sub
More Information
OL2000: How to Programmatically Synchronize Folders (MSKB)
NameSpace.SyncObjects Property (TechNet)
I still keep getting the "You have emails in your sent box....." exiting in 30 second countdown..
Because I have put a Application.quit in the vba code in outlook?
How do I keep this msgbox from popping up ?
Do you have messages waiting to be sent? I'm not aware of anyway to avoid that error if there are messages in the outbox.
Yes, They are in outbox..
If there are messages, you should always get that warning message. There are scripts available that will respond to dialogs (such as ClickYes) - you might be able to incorporate that into the macro.