SyncObject.OnError event (Outlook)
Occurs when Microsoft Outlook encounters an error while synchronizing a user's folders using the specified Send\Receive group.
Syntax
expression. OnError
( _Code_
, _Description_
)
expression A variable that represents a SyncObject object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Code | Required | Long | A unique value that identifies the error. |
Description | Required | String | A textual description of the error. |
Remarks
This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).
Example
This Microsoft Visual Basic for Applications (VBA) example displays a message box describing the synchronization error when an error occurs during synchronization. The sample code must be placed in a class module, and the Initialize_handler
routine must be called before the event procedure can be called by Outlook.
Public WithEvents mySync As Outlook.SyncObject
Sub Initialize_handler()
Set mySync = Application.Session.SyncObjects.Item(1)
mySync.Start
mySync.Stop
End Sub
Private Sub mySync_OnError(ByVal Code As Long, ByVal Description As String)
MsgBox "Unexpected sync error" & Code & ": " & Description
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.