Freigeben über


WorkbookBase.SyncEvent Event

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

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public Event SyncEvent As WorkbookEvents_SyncEventHandler
public event WorkbookEvents_SyncEventHandler SyncEvent

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.

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
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.");
    }
}

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace