Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.
Sub toggleScheduledSendReceive() ' 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 x 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 Line2: Application.ActiveExplorer().CommandBars("Standard").Controls("Send/Re&ceive").Controls("Send/Recei&ve Settings").Controls("&Disable Scheduled Send/Receive").Execute Line2b: If OutlookSendReceiveWasPreviouslyDisabled Then MsgBox "Send/Receive schedule has been Enabled." Else msgBox "Send/Receive and Server Import schedules have been Disabled" End If exit_sub: Exit Sub err_routine: msgBox Error$ Resume exit_sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.