WorkbookSync Event

Microsoft Excel Visual Basic

Show All Show All

WorkbookSync Event

Occurs when the local copy of a workbook that is part of a Document Workspace is synchronized with the copy on the server.

Private Sub object_WorkbookSync(Wb, SyncEventType)

object    An object of type Workbook declared by using the WithEvents keyword in a class module.

Wb    Workbook. The workbook being synchronized.

SyncEventType    Required MsoSyncEventType. The status of the workbook synchronization.

MsoSyncEventType can be one of the following msoSyncEventType constants:

msoSyncEventDownloadFailed
msoSyncEventDownloadInitiated
msoSyncEventDownloadNoChange
msoSyncEventDownloadSucceeded
msoSyncEventOffline
msoSyncEventUploadFailed
msoSyncEventUploadInitiated
msoSyncEventUploadSucceeded

Example

The following example displays a message if the synchronization of a workbook in a Document Workspace fails.

    Private Sub app_WorkbookSync(ByVal Wb As Workbook, _
        ByVal SyncEventType As Office.MsoSyncEventType)
    
    If SyncEventType = msoSyncEventDownloadFailed Or _
            SyncEventType = msoSyncEventUploadFailed Then
            
        MsgBox "Workbook synchronization failed. " & _
            "Please contact your administrator " & vbCrLf & _
            "or try again later."
    
    End If

End Sub