In outlook 2010 I could toggle send/receive with this code
ble Scheduled Send/Receive").Execute.
So how can I do the same thing with Outlook 2013?
P.S. here is the full vba that worked in outlook 2010 and earlier.
' this only works in Outlook 2010 and earlier
' the Line1 code must run BEFORE the Line2 .execute command
' if Line1 comes after the .execute it will randomly return the control's PREVIOUS value rather than the TOGGLED value.
' this because the .execute runs asynchrously.
' Vba starts the .execute, then resumes at line2B
' even though the toggle may or may not have finished.
On Error GoTo err_routine
Dim OutlookSendReceiveWasPreviouslyDisabled As Boolean
Line1: OutlookSendReceiveWasPreviouslyDisabled = Application.ActiveExplorer().CommandBars("Standard").Controls("Send/Re&ceive").Controls("Send/Recei&ve Settings").Controls("&Disable Scheduled Send/Receive").State
Application.ActiveExplorer().CommandBars("Standard").Controls("Send/Re&ceive").Controls("Send/Recei&ve Settings").Controls("&Disable Scheduled Send/Receive").Execute
If OutlookSendReceiveWasPreviouslyDisabled Then
MsgBox "Send/Receive schedule has been Enabled."
msgBox "Send/Receive and Server Import schedules have been Disabled"