Offline Property

Microsoft Outlook Visual Basic

Offline Property

       

Returns a Boolean indicating whether Microsoft Outlook is online (connected to a server) or Offline (not connected to a server). Returns True if Outlook is offline. Read-only.

expression.Offline

expression   Required. An expression that returns a Namespace object.

Example

The following function returns True or False depending on whether the Namespace object is currently online.

Sub Off()
'Determines whether Outlook is currently Offline
    Dim olapp As New Outlook.Application
    Dim nmsName As NameSpace
    Set olapp = Outlook.Application
    Set nmsName = olapp.GetNamespace("MAPI")
    Dim blnOff As Boolean
    blnOff = IsOffline(nmsName)
End Sub

Function IsOffline(ByRef nmsName As NameSpace) As Boolean
'Retuns True if Outlook is offline
     IsOffline = nmsName.offline
End Function