Share via


WorkbookBase.SharedWorkspace Property

Definition

Gets a Microsoft.Office.Core.SharedWorkspace that represents the Document Workspace in which the workbook is located.

public:
 property Microsoft::Office::Core::SharedWorkspace ^ SharedWorkspace { Microsoft::Office::Core::SharedWorkspace ^ get(); };
public Microsoft.Office.Core.SharedWorkspace SharedWorkspace { get; }
member this.SharedWorkspace : Microsoft.Office.Core.SharedWorkspace
Public ReadOnly Property SharedWorkspace As SharedWorkspace

Property Value

A Microsoft.Office.Core.SharedWorkspace that represents the Document Workspace in which the workbook is located.

Examples

The following code example uses the SharedWorkspace property to determine whether the current workbook is part of a Document Workspace. If the workbook is part of a Document Workspace, then the example uses the Sync property to display the user who last changed the document.

This example is for a document-level customization.

private void DisplayLastChangeBy()
{
    if (this.SharedWorkspace.Connected)
    {
        MessageBox.Show("Last changed by: " +
            this.Sync.WorkspaceLastChangedBy);
    }
    else
    {
        MessageBox.Show("The current document is not connected " +
            "to a shared workspace.");
    }
}
Private Sub DisplayLastChangeBy()
    If Me.SharedWorkspace.Connected Then
        MsgBox("Last changed by: " & _
            Me.Sync.WorkspaceLastChangedBy)
    Else
        MsgBox("The current document is not connected " & _
            "to a shared workspace.")
    End If
End Sub

Applies to