Application.DocumentSync 事件 (Word)Application.DocumentSync Event (Word)

该对象或成员已被弃用,但它仍保留为对象模型的一部分以实现向后兼容。This object or member has been deprecated, but it remains part of the object model for backward compatibility. 不应在新应用程序中使用它。You should not use it in new applications.


专用 Sub_DocumentSyncDocSyncEventTypePrivate Sub_DocumentSync(Doc , SyncEventType)

_表达式_代表一个类模块中使用WithEvents关键字声明的应用程序对象的变量。expression A variable that represents an 'Application' object declared using the WithEvents keyword in a class module.


名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
DocDoc 必需Required DocumentDocument 进行同步的文档。The document being synchronized.
SyncEventTypeSyncEventType 必需Required MsoSyncEventTypeMsoSyncEventType 文档同步的状态。The status of the document synchronization.


有关使用Application对象事件的信息,请参阅使用 Application 对象的事件For information about using events with the Application object, see Using Events with the Application Object.


以下示例在"文档工作区"中的文档同步失败时显示一条消息。The following example displays a message if the synchronization of a document in a Document Workspace fails.

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

另请参阅See also

Application 对象Application Object