Office) (Sync.Status 屬性
會取得使用中文件之本機複本與伺服器複本的同步處理狀態。 唯讀。
注意事項
自 Microsoft Office 2010 起,這個物件或成員已被取代且不應該再使用。
語法
運算式。地位
需要 expression。 代表 Sync 物件的變數。
註解
使用 Status 屬性來判斷是否將使用中文件的本機複本會與共用的伺服器複本同步處理。 使用 GetUpdate 方法來重新整理狀態。
適當時,請使用下列方法和屬性來回應各種 狀態條件:
msoSyncStatusConflict。 當 本機和伺服器複本都有變更時,則為 True。 Use the ResolveConflict method to resolve the differences.
msoSyncStatusError。 檢查 ErrorType 屬性。
msoSyncStatusLocalChanges。 如果 只有本機複本有變更,則為 True。 Use the PutUpdate method to save local changes to the server copy.
msoSyncStatusNewerAvailable。 如果 只有伺服器複本有變更,則為 True。 Close and re-open the document to work with the latest copy from the server.
msoSyncStatusSuspended。 使用 Unsuspend 方法繼續同步處理。
Status 屬性會從清單中的優先順序下列順序傳回單一常數:
msoSyncStatusNoSharedWorkspace
msoSyncStatusError
msoSyncStatusSuspended
msoSyncStatusConflict
msoSyncStatusNewerAvailable
msoSyncStatusLocalChanges
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 支援與意見反應。