次の方法で共有


Sync.Status プロパティ (Office)

アクティブ ドキュメントのローカル コピーとサーバー コピーの同期の状態を取得します。 読み取り専用です。

注:

Microsoft Office 2010 以降、このオブジェクトまたはメンバーは推奨されていないため、使用しないでください。

構文

ステータス

expression 必須です。 Sync オブジェクトを表す変数です。

注釈

作業中の文書のローカル コピーが共有サーバーのコピーを同期するかどうかを判断するのにには、 Status プロパティを使用します。 状態を更新するのにには、 GetUpdate メソッドを使用します。

適切な場合は、次のメソッドとプロパティを使用して、さまざまな 状態条件に対応します。

  • msoSyncStatusConflictTrue を指定 すると、ローカル コピーとサーバー コピーの両方に変更が加えられます。 Use the ResolveConflict method to resolve the differences.

  • msoSyncStatusErrorErrorType プロパティを確認します。

  • msoSyncStatusLocalChangesTrue の 場合は、ローカル コピーにのみ変更があります。 Use the PutUpdate method to save local changes to the server copy.

  • msoSyncStatusNewerAvailableTrue の 場合は、サーバー のコピーにのみ変更があります。 Close and re-open the document to work with the latest copy from the server.

  • msoSyncStatusSuspendedUnsuspend メソッドを使用して同期を再開します。

Status プロパティは、次の優先順位の一覧から 1 つの定数を返します。

  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 のサポートおよびフィードバックを参照してください。