共用方式為


Sync.Status 屬性 (Office)

會取得使用中文件之本機複本與伺服器複本的同步處理狀態。 唯讀。

注意事項

自 Microsoft Office 2010 起,這個物件或成員已被取代且不應該再使用。

語法

表情地位

需要 expression。 代表 Sync 物件的變數。

註解

使用 Status 屬性來判斷是否將使用中文件的本機複本會與共用的伺服器複本同步處理。 使用 GetUpdate 方法來重新整理狀態。

適當時,請使用以下方法與屬性來回應各種 狀態條件

  • msoSyncStatusConflict。 當本地和伺服器版本都有變動時,這是正確的。 Use the ResolveConflict method to resolve the differences.

  • mso同步狀態錯誤。 檢查 ErrorType 屬性。

  • msoSyncStatusLocalChanges。 只有本地副本有變更時,這是真的。 Use the PutUpdate method to save local changes to the server copy.

  • msoSyncStatusNewerAvailable。 只有伺服器版本有變更時,這點是正確的。 Close and re-open the document to work with the latest copy from the server.

  • msoSyncStatusSuspended。 使用 解除懸掛(Unsuspend )方法來恢復同步。

Status 屬性會從清單中的優先順序下列順序傳回單一常數:

  1. msoSyncStatusNoSharedWorkspace

  2. msoSyncStatusError

  3. msoSyncStatusSuspended

  4. msoSyncStatusConflict

  5. msoSyncStatusNewerAvailable

  6. msoSyncStatusLocalChanges

  7. msoSyncStatusLatest

範例

下列範例會檢查 Status 屬性並採取適當的動作來同步處理必要時的文件的本機與伺服器複本。

    Dim objSync As Office.Sync 
    Dim strStatus As String 
    Set objSync = ActiveDocument.Sync 
    If objSync.Status > msoSyncStatusNoSharedWorkspace Then 
        Select Case objSync.Status 
            Case msoSyncStatusConflict 
                objSync.ResolveConflict msoSyncConflictMerge 
                ActiveDocument.Save 
                objSync.ResolveConflict msoSyncConflictClientWins 
                strStatus = "Conflict resolved by merging changes." 
            Case msoSyncStatusError 
                strStatus = "Last error type: " & objSync.ErrorType 
            Case msoSyncStatusLatest 
                strStatus = "Document copies already in sync." 
            Case msoSyncStatusLocalChanges 
                objSync.PutUpdate 
                strStatus = "Local changes saved to server." 
            Case msoSyncStatusNewerAvailable 
                strStatus = "Newer copy available on the server." 
            Case msoSyncStatusSuspended 
                objSync.Unsuspend 
                strStatus = "Synchronization resumed." 
        End Select 
    Else 
        strStatus = "Not a shared workspace document." 
    End If 
    MsgBox strStatus, vbInformation + vbOKOnly, "Sync Information" 
    Set objSync = Nothing 

另請參閱

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應