Sync.GetUpdate Method (Office)Sync.GetUpdate Method (Office)

将共享文档的本地版本与服务器上的版本进行比较。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

expressionexpression. GetUpdate

_表达式_一个代表Sync对象的变量。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.

并非所有文档同步问题都引发可捕获的运行时错误。Not all document synchronization problems raise trappable run-time errors. 后执行操作使用Sync对象,它是最好检查您的状态属性。Status属性是否msoSyncStatusError,检查ErrorType属性的已发生的错误类型的其他信息。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方法。In many circumstances, the best way to resolve an error condition is to call the GetUpdate method. 例如,如果PutUpdate错误条件导致调用,然后调用GetUpdate将重置状态为msoSyncStatusLocalChangesFor 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