Compartilhar via


WorkbookBase.SyncEvent Event

Definition

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

public:
 event Microsoft::Office::Interop::Excel::WorkbookEvents_SyncEventHandler ^ SyncEvent;
public event Microsoft.Office.Interop.Excel.WorkbookEvents_SyncEventHandler SyncEvent;
member this.SyncEvent : Microsoft.Office.Interop.Excel.WorkbookEvents_SyncEventHandler 
Public Custom Event SyncEvent As WorkbookEvents_SyncEventHandler 

Event Type

Examples

The following code example demonstrates a handler for the SyncEvent event. The event handler displays a message if the synchronization of a worksheet in a Document Workspace fails.

This example is for a document-level customization.

private void WorkbookSyncEvent()
{
    this.SyncEvent +=
        new Excel.WorkbookEvents_SyncEventHandler(
        ThisWorkbook_SyncEvent);
}

void ThisWorkbook_SyncEvent(Office.MsoSyncEventType SyncEventType)
{
    if (SyncEventType == Office.MsoSyncEventType.msoSyncEventDownloadFailed ||
        SyncEventType == Office.MsoSyncEventType.msoSyncEventUploadFailed)
    {
        MessageBox.Show("Document synchronization failed.");
    }
}
Sub ThisWorkbook_SyncEvent( _
    ByVal SyncEventType As Office.MsoSyncEventType) _
    Handles Me.SyncEvent

    If SyncEventType = _
        Office.MsoSyncEventType.msoSyncEventDownloadFailed OrElse _
        SyncEventType = Office.MsoSyncEventType.msoSyncEventUploadFailed Then
        MsgBox("Document synchronization failed.")
    End If
End Sub

Applies to