Delete or Unlink a Shared List

You can remove a list or remove the link between the worksheet list and the SharePoint list through Excel or through code. Deleting a list from the server is a little trickier, however.

Note

As with workspaces, removing and unlinking lists from SharePoint is a basic management task. You need to know this stuff.

How to do it

From Excel, use the List menu to unlink or convert a list to a range. To delete it from the worksheet, select the list and use Clear All.

From code, use these ListObject methods to unlink, unlist, or delete a list:

MethodUse to

Unlink

Remove the link between the worksheet list and the SharePoint list

Unlist

Convert the worksheet list to a range, preserving the list’s data

Delete

Delete the worksheet list and all its data

Once you have unlinked a list, you can’t relink it. To re-establish the link, you must delete the list and insert it back onto the worksheet from the SharePoint list.

All of these methods affect only the worksheet list. The SharePoint list can only be deleted using the SharePoint site or the Lists web service. To delete the SharePoint list from code, create a web reference to the Lists web service and use the following DeleteList method:

   Dim lws As New clsws_Lists  ' Requires Web reference to 
   SharePoint 
Lists.asmx
   lws.wsm_DeleteList ("Excel Objects")

If you delete a SharePoint list, but not the worksheet list that shares it, you get an error when you attempt to refresh or update the worksheet ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.