Status Property

Microsoft Office Visual Basic

Show All Show All

Status Property

ShowStatus property as it applies to the SharedWorkspaceTask object.

Returns or sets the status of the specified shared workspace task. Read/write msoSharedWorkspaceTaskStatus.

MsoSharedWorkspaceTaskStatus can be one of these msoSharedWorkspaceTaskStatus constants.
msoSharedWorkspaceTaskStatusComplete (3)
msoSharedWorkspaceTaskStatusDeferred (2)
msoSharedWorkspaceTaskStatusInProgress (1)
msoSharedWorkspaceTaskStatusNotStarted (4)
msoSharedWorkspaceTaskStatusWaiting (5)

expression.Status

expression    Required. An expression that returns a SharedWorkspaceTask object.

Remarks

The shared workspace task schema on the server can be customized. Customization of the schema may affect the task status enumeration when the Add or Save method is called. Status property values are mapped as follows:

  • Downloaded values 1 through 5 are mapped to msoSharedWorkspaceTaskStatus enumeration values 1 through 5. Schema values beyond 5 are mapped to enumeration value 1 (msoSharedWorkspaceTaskStatusInProgress).
  • Uploaded enumeration values 1 through 5 are mapped to schema values 1 through 5. If a user-specified value does not map to any value defined in the schema, the user-specified value is silently ignored and the Status property is not updated on the server.

ShowStatus property as it applies to the Sync object.

Returns the status of the synchronization of the local copy of the active document with the server copy. Read-only MsoSyncStatusType.

MsoSyncStatusType can be one of the following msoSyncStatusType constants.
msoSyncStatusConflict (4)
msoSyncStatusError (6)
msoSyncStatusLatest (1)
msoSyncStatusLocalChanges (3)
msoSyncStatusNewerAvailable (2)
msoSyncStatusNoSharedWorkspace (0)
msoSyncStatusSuspended (5)

expression.Status

expression    Required. An expression that returns a Sync object.

Remarks

Use the Status property to determine whether the local copy of the active document is synchronized with the shared server copy. Use the GetUpdate method to refresh the status. Use the following methods and properties when appropriate to respond to various status conditions:

  • msoSyncStatusConflict - True when both the local and the server copies have changes. Use the ResolveConflict method to resolve the differences.
  • msoSyncStatusError - Check the ErrorType property.
  • msoSyncStatusLocalChanges - True when only the local copy has changes. Use the PutUpdate method to save local changes to the server copy.
  • msoSyncStatusNewerAvailable - True when only the server copy has changes. Close and re-open the document to work with the latest copy from the server.
  • msoSyncStatusSuspended - Use the Unsuspend method to resume synchronization.

The Status property returns a single constant from the list in the following order of precedence:

  1. msoSyncStatusNoSharedWorkspace
  2. msoSyncStatusError
  3. msoSyncStatusSuspended
  4. msoSyncStatusConflict
  5. msoSyncStatusNewerAvailable
  6. msoSyncStatusLocalChanges
  7. msoSyncStatusLatest

Example

ShowAs it applies to the SharedWorkspaceTask object.

The following example displays a list of all tasks in the current shared workspace whose status is not set to Complete.

          Dim swsTask As Office.SharedWorkspaceTask
    Dim strTaskStatus As String
    For Each swsTask In ActiveWorkbook.SharedWorkspace.Tasks
        If swsTask.Status <> msoSharedWorkspaceTaskStatusCompleted Then
            strTaskStatus = strTaskStatus & swsTask.Title & vbCrLf
        End If
    Next
    MsgBox "The following tasks have not been completed:" & vbCrLf & _
        strTaskStatus, vbInformation + vbOKOnly, "Incomplete Tasks"
    Set swsTask = Nothing

    

ShowAs it applies to the Sync object.

The following example examines the Status property and takes an appropriate action to synchronize the local and server copies of the document if necessary.

          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