Name

listobject.Unlink( )

Synopsis

Removes the link between the data in the list on a worksheet and the data in the list on a SharePoint server. This link allows the worksheet list to synchronize with the SharePoint list. The following code removes the link from a list:

Sub UnlinkList(  )
    Dim ws As Worksheet, lst As ListObject
    Set ws = ActiveSheet
    Set lst = ws.ListObjects(1)
    lst.Unlink
End Sub

No error occurs if the list was not previously shared.

Once the link is removed, the worksheet list can’t be relinked to the SharePoint list. To re-establish a link, you must delete the list on the worksheet, then insert the shared list from the SharePoint server onto the worksheet.

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.