SharedWorkspaceFiles.Add method (Office)
Adds a file to the document library in a shared workspace. Returns a SharedWorkspaceFile object.
Note
Beginning with Microsoft Office 2010, this object or member has been deprecated and should not be used.
Syntax
expression.Add (FileName, ParentFolder, OverwriteIfFileAlreadyExists, KeepInSync)
expression Required. A variable that represents a SharedWorkspaceFiles object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
FileName | Required | String | The path and file name of the file to be added to the current shared workspace. |
ParentFolder | Optional | SharedWorkspaceFolder | The subfolder in which to place the file, if not the main document library folder within the shared workspace. Add the file to the main document library folder by leaving this optional argument empty. |
OverwriteIfFileAlreadyExists | Optional | Boolean | True to overwrite an existing file by the same name. Default is False. |
KeepInSync | Optional | Boolean | True to keep the local copy of the document synchronized with the copy in the shared workspace. Default is False. |
Example
The following example adds a new file to the files collection of the shared workspace.
Dim swsfile As Office.SharedWorkspaceFile
Set swsfile = ActiveWorkbook.SharedWorkspace.Files.Add( _
"C:\MyWorkbook.xls", _
, True, True)
MsgBox "New file URL: " & swsfile.URL, _
vbInformation + vbOKOnly, _
"New File in Shared Workspace Files"
Set swsfile = Nothing
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for