I have a macro-enabled workbook, that has a macro that should save a copy of the file to a new location. I store the name of the original file as a string before saving to the new location, so that I can still reference the original file in the original location. The file still exists there, and the filename string works when I open the file using it, but it doesn't work when I try to do anything else with the string.
The original location is a folder called Source, and the file is copied to the folder called Destination.
The important problem here, is that the folders are located on SharePoint. If the folders are on a local machine it's not an issue.
https://[company].sharepoint.com/sites/[team]/Shared Documents/General/Source/oldVersion.xlsm
https://[company].sharepoint.com/sites/[team]/Shared Documents/General/Destination/newVersion.xlsm
Sub testMove()
FullName = Application.ActiveWorkbook.FullName
ActiveWorkbook.SaveAs "https://[company].sharepoint.com/sites/" _
& "[team]/Shared Documents/General/Destination/newVersion.xlsm", xlOpenXMLWorkbookMacroEnabled
'SetAttr FullName, vbNormal
Workbooks.Open FullName
End Sub
The above code runs just fine, but when you uncomment the setAttr it gets a file not found error.
The goal is to be able to close and/or delete the file in the original location, so SaveCopyAs doesn't quite work for this purpose.