Hi, I'm new to VBA and struggling. I'm trying to copy an existing Word document in a SharePoint folder, renaming it for use as a backup, and same it into the same SharePoint folder with the existing Word document. In other words, I would like to have the existing document and backup document in the same SharePoint folder. I have tried the following code to first check if the document exists. But I keep getting an error 53 (File Not Found) on the "objFSO.CopyFile" line. I know the file is there. I'm not sure if I have to open the document first before renaming and saving. Any help would be greatly appreciated.
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("\\cafe.site.com\sharepoint\Doc Name.docx) Then
objFSO.CopyFile "\\cafe.site.com\sharepoint\Doc Name.docx", "\\cafe.site.com\sharepoint\Doc Name\Backup.docx", True
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("\\cafe.site.com\sharepoint\Doc Name.docx) Then
objFSO.CopyFile "\\cafe.site.com\sharepoint\Doc Name.docx", "\\cafe.site.com\sharepoint\Doc Name\Backup.docx", True
End If