Hi Mr. Excel,
Thank you for reading my post! Long time lurker, first time poster.
The code below is meant to save a file as two different naming conventions and save each to a different Sharepoint site. The issue that has arisen is that this workedeven last week, but now it is telling me Path not found for all the paths I try. I have pasted the paths into my browser andconfirmed that they opened the right page with no trouble, so I don’t know whatelse to test. All answers about postingto Sharepoint use the CopyFile FromPath ToPath method, but that’s the one thatis now giving me (and my team when they test) issues.
I understand that my code doesn’t include the actual websitepaths, but I assure you that they do work when pasted into my browser, and theyworked in the past, so I’m trying to determine if the actual method is theproblem.
Thank you for reading my post! Long time lurker, first time poster.
The code below is meant to save a file as two different naming conventions and save each to a different Sharepoint site. The issue that has arisen is that this workedeven last week, but now it is telling me Path not found for all the paths I try. I have pasted the paths into my browser andconfirmed that they opened the right page with no trouble, so I don’t know whatelse to test. All answers about postingto Sharepoint use the CopyFile FromPath ToPath method, but that’s the one thatis now giving me (and my team when they test) issues.
I understand that my code doesn’t include the actual websitepaths, but I assure you that they do work when pasted into my browser, and theyworked in the past, so I’m trying to determine if the actual method is theproblem.
Code:
Sub SharePointExport()
'Saves the file to the appropriate sharepoint site based on the region
Dim objOutlookMsg As Object
Dim OperatingUnit As String
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim MSBPathCheck As String
Dim RegionPathCheck As String
Dim FilePath As String
Dim Sheet_Password As String
FromPath = ThisWorkbook.FullName
MSBPathCheck = Range("MSBPathCheck").value
RegionPathCheck = Range("RegionPathCheck").value
Set OutApp = Nothing
Set objOutlookMsg =Nothing
OperatingUnit = Range("Oper_Unit").value
'MSB Upload
If ActiveWorkbook.Sheets("Settings").Range("SharePointURLMSB")<> "No URL" Then
ToPath =Range("ToPath").value & Range("MSBUploadName").value
Set FSO =CreateObject("scripting.filesystemobject")
FSO.CopyFileSource:=FromPath, Destination:=ToPath
End If
‘RegionUpload:
If ActiveWorkbook.Sheets("Settings").Range("SharePointURLMSB")<> "No URL" Then
ToPath =Range("RegionalUploadName").value
Set FSO =CreateObject("scripting.filesystemobject")
FSO.CopyFileSource:=FromPath, Destination:=ToPath
End If
ThisWorkbook.Saved = True
Exit Sub
End Sub