Skip to Main Content
Excel 2003 Programming: A Developer's Notebook
book

Excel 2003 Programming: A Developer's Notebook

by Jeff Webb
August 2004
Intermediate to advanced content levelIntermediate to advanced
312 pages
8h 30m
English
O'Reilly Media, Inc.
Content preview from Excel 2003 Programming: A Developer's Notebook

Remove Sharing

You can remove sharing from a workbook stored in a shared workspace at two levels:

  • Delete the file from the SharePoint server. This breaks the connection for all users.

  • Disconnect the local workbook from the shared workspace. This breaks the connection between the local copy of the workbook and the server.

How to do it

Use the RemoveDocument method to delete the current document from the shared workspace, as shown by the following code:

   If ThisWorkbook.SharedWorkspace.Connected Then _
       ThisWorkbook.SharedWorkspace.RemoveDocument

The preceding code leaves local copies that users have downloaded from the shared workspace, but they become disconnected since the shared workbook no longer exists. Alternatively, you can leave the workbook in the shared workspace, but disconnect your local copy with this code:

   If ThisWorkbook.SharedWorkspace.Connected Then _
       ThisWorkbook.SharedWorkspace.Disconnect

Now, the local copy can no longer be updated from, or send updates to, the shared workbook. If you want an updatable copy, you must reopen the workbook from the shared workspace. There’s no way to reattach an existing local workbook to the server copy.

You can also use the Files collection to remove workbooks from a shared workspace. This technique works well if you want to remove a file other than the current workbook. For example, the following code removes Security.xls from the current workbook’s shared workspace:

 Dim file As Office.SharedWorkspaceFile If ThisWorkbook.SharedWorkspace.Connected ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® Office Excel 2003 Programming Inside Out

Microsoft® Office Excel 2003 Programming Inside Out

Curtis Frye, Wayne S. Freeze, Felicia K. Buckingham
Excel® 2007 VBA Programmer's Reference

Excel® 2007 VBA Programmer's Reference

John Green, Stephen Bullen, Rob Bovey, Michael Alexander
Office 2003 XML

Office 2003 XML

Simon St. Laurent, Mary McRae, Evan Lenz

Publisher Resources

ISBN: 0596007671Supplemental ContentCatalog PageErrata