Use VBA to initiate a Send/Receive for a specific account

Last reviewed on September 3, 2012

Applies to Microsoft Outlook 2013, Outlook 2010, Outlook 2007, Outlook 2003 and below

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.

Send and Receive Group numbersThis 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

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999 and involved in IT support since 1985, Diane is the author of several books and video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.