File copy Permission denied using file system object

Joined
Mar 14, 2020
Messages
2
Reaction score
0
I am trying to copy file from local to shareddrive where I am getting permission denied error. But I am able to copy manually it's working fine.
 
i am trying to copy files from localfolder to sharedpoint where i am getting error 70 "Permission denied" . but when i copy paste manually its working fine. i dont have any problem in folder permission , only issues is using FSO. can anyone guide me on it.

Sub Copy_d()
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
FromPath = "give excel path" ToPath = "give share point path"
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " Path doesn't exist"
Exit
Sub End
If FSO.CopyFolder Source:=FromPath, Destination:=ToPath
MsgBox " copied " & ToPath
End Sub
 
Back
Top