Table of contents
TOC
折叠目录
展开目录

Sync.GetUpdate 方法 (办公室)Sync.GetUpdate Method (Office)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

将共享文档的本地版本与服务器上的版本进行比较。Compares the local version of the shared document to the version on the server.

请注意 开始使用 Microsoft Office 2010年,此对象或成员已否决,并不应使用。Note Beginning with Microsoft Office 2010, this object or member has been deprecated and should not be used.

语法Syntax

表达式GetUpdateexpression. GetUpdate

表达式_一个表示同步对象的变量。_expression A variable that represents a Sync object.

注解Remarks

若要为服务器上的版本的共享文档的本地版本进行比较,并刷新同步状态,则使用GetUpdate方法。Use the GetUpdate method to compare the local version of the shared document to the version on the server and to refresh the sync status.

不是所有文档同步问题都会都引发可捕获的运行时错误。执行后使用同步对象的操作,最好检查状态属性;如果状态属性msoSyncStatusError,请,检查ErrorType属性以获取有关所发生错误的类型。Not all document synchronization problems raise trappable run-time errors. After performing an operation using the Sync object, it's a good idea to check the Status property; if the Status property is msoSyncStatusError, check the ErrorType property for additional information on the type of error that has occurred.

在许多情况下,解决错误情况的最好办法是调用GetUpdate方法。例如,如果PutUpdate导致错误情况的调用,然后GetUpdate调用将重置状态为msoSyncStatusLocalChangesIn many circumstances, the best way to resolve an error condition is to call the GetUpdate method. For example, if a call to PutUpdate results in an error condition, then a call to GetUpdate will reset the status to msoSyncStatusLocalChanges.

示例Example

下面的示例将使用GetUpdate方法和报告服务器是否有更新的副本的文档的本地副本和服务器副本进行比较。The following example compares the local and server copies of the document using the GetUpdate method and reports whether the server has a newer copy.

    Dim objSync As Office.Sync 
    Dim strStatus As String 
    Set objSync = ActiveDocument.Sync 
    objSync.GetUpdate 
    If objSync.Status = msoSyncStatusNewerAvailable Then 
        strStatus = "A newer version is available on the server." 
        MsgBox strStatus, vbInformation + vbOKOnly, "Sync Information" 
    End If 
    Set objSync = Nothing 
© 2018 Microsoft