Removes the active document from the shared workspace site.
Note Beginning with Microsoft Office 2010, this object or member has been deprecated and should not be used.
expression. RemoveDocument
expression A variable that represents a SharedWorkspace object.
If the user does not have permission to remove the shared workspace document from the server, then the server copy remains intact, but the local copy of the document is disconnected from the shared workspace. In the case where the document was opened directly from the workspace, then removed from the workspace using RemoveDocument, the document must be saved to another location before closing; otherwise, it remains in the workspace.
Use the Disconnect method to detach the local copy of the document from the shared workspace without removing the shared copy.
The following example determines whether the active document is connected to a shared workspace, then offers the user the option of removing the document from the workspace site.
Dim r As Long
If ActiveWorkbook.SharedWorkspace.Connected Then
r = MsgBox("Are you sure you want to remove this document?", _
vbQuestion + vbOKCancel, "Are you sure?")
If r = vbOK Then
ActiveWorkbook.SharedWorkspace.RemoveDocument
MsgBox "The document is removed.", _
vbInformation + vbOKOnly, "Removed"
Else
MsgBox "Removal canceled.", _
vbInformation + vbOKOnly, "Still In Workspace"
End If
Else
MsgBox "The active document is not connected to a shared workspace.", _
vbInformation + vbOKOnly, "Not Connected"
End If