Bagikan melalui


Workbook.SyncEvent Event (2007 System)

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.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Event SyncEvent As WorkbookEvents_SyncEventHandler
'Usage
Dim instance As Workbook 
Dim handler As WorkbookEvents_SyncEventHandler 

AddHandler instance.SyncEvent, handler
public event WorkbookEvents_SyncEventHandler SyncEvent
public:
 event WorkbookEvents_SyncEventHandler^ SyncEvent {
    void add (WorkbookEvents_SyncEventHandler^ value);
    void remove (WorkbookEvents_SyncEventHandler^ value);
}
JScript does not support events.

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

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace