Name

workbook.SharedWorkspace

Synopsis

For workbooks that are part of a shared workspace, returns the SharedWorkspace object used to connect to and maintain the workbook through the SharePoint server. The SharedWorkspace object exists even if the workbook is not shared via SharePoint Services. You can tell whether or not a workbook is part of a shared workspace by checking the object’s Connected property. For example, the following code checks if a workbook is part of a shared workspace before adding another workbook to the shared workspace:

Dim sw As Office.SharedWorkspace
Set sw = ThisWorkbook.SharedWorkspace
If sw.Connected Then
    sw.Files.Add ThisWorkbook.Path & "\" & "new.xls"
End If

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.