Name

listobject.UpdateChanges([iConflictType])

Synopsis

Synchronizes the shared list on a worksheet with the list on the SharePoint server. The setting of iConflictType determines how list items with changes on both the worksheet and SharePoint server are handled.

Setting

Description

xlListConflictDialog

Displays the Resolve Conflicts and Errors dialog box to resolve the conflict (this is the default).

xlListConflictRetryAllConflicts

Replaces conflicting data on the SharePoint server with data from the worksheet.

xlListConflictDiscardAllConflicts

Replaces conflicting data on the worksheet with updates from the SharePoint server.

xlListConflictError

Updates the items that do not conflict and generates an error, “Cannot update the list to Windows SharePoint Services,” leaving the conflicting items unchanged.

If the worksheet list is not shared, UpdateChanges causes an error.

The following code synchronizes a list and overwrites conflicting items with the worksheet version of the item (local version wins):

Sub SyncLocalWins(  )
    Dim ws As Worksheet, lst As ListObject
    Set ws = ActiveSheet
    Set lst = ws.ListObjects("Test List")
    lst.UpdateChanges xlListConflictRetryAllConflicts
End Sub

The following code synchronizes a list and overwrites conflicting items with the SharePoint version of the item (server version wins):

Sub SyncServerWins( ) Dim ws As Worksheet, lst As ListObject Set ws = ActiveSheet Set lst = ws.ListObjects("Test List") lst.UpdateChanges xlListConflictDiscardAllConflicts ...

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.