Share via


Sync.LastSyncTime Property

Office Developer Reference

Gets the date and time when the local copy of the active document was last synchronized with the server copy. Read-only.

Syntax

expression.LastSyncTime

expression   A variable that represents a Sync object.

Remarks

Use the LastSyncTime property to determine how much time has elapsed since the local copy of the active document was last synchronized with the server copy. Check the Status property to determine whether the local copy and the server copy are out of sync.

If the active document is not configured for synchronization between the local copy and the server copy, the LastSyncTime property raises a run-time error.

Example

The following example alerts the user and displays the sync status if more than 24 hours have elapsed since the LastSyncTime.

Visual Basic for Applications
      Dim objSync As Office.Sync
    Dim dtmLastSync As Date
    Dim strStatus As String
    Set objSync = ActiveDocument.Sync
    dtmLastSync = CDate(objSync.LastSyncTime)
    If DateDiff("h", dtmLastSync, Now) > 24 Then
        strStatus = "Document has not been synced " & _
            " within the last 24 hours." & vbCrLf & _
            "Document status: " & objSync.Status
        MsgBox strStatus, vbInformation + vbOKOnly, "Error Information"
    End If
    Set objSync = Nothing

See Also