Pages

Showing posts with label Script. Show all posts
Showing posts with label Script. Show all posts

Wednesday, January 24, 2024

Set Outlook Offline

Set Outlook Offline
Sub SetOfflineMode()
Dim appOutlook
Dim blnIsOffline

On Error Resume Next
Set appOutlook = CreateObject("Outlook.Application")

  If Err.Number = 0 Then
     blnIsOffline = appOutlook.Session.Offline
   If Not blnIsOffline Then
     appOutlook.ActiveExplorer.CommandBars.ExecuteMso ("ToggleOnline")
   End If
  Else
  End If
If Not (appOutlook Is Nothing) Then Set appOutlook = Nothing
End Sub