<tbody>
[TD="class: votecell"]
[TD="class: postcell"] Hi I am trying to copy a folder from and paste it into another folder which I have created on my desktop. The creation of the folder went succesfully but copying doesn't seem to work for some reason. It keep getting the error that the filename cannot be found although the pathname is correct. Thanks
[/TD]
</tbody>
I am trying to copy a folder from and paste it into another folder which I have created on my desktop. The creation of the folder went succesfully but copying doesn't seem to work for some reason. It keep getting the error that the filename cannot be found although the pathname is correct.
Can somebody help?
Sub UsingScriptingRunObjectLibrary()
Dim fso As Scripting.FileSystemObject
Dim NewFolderPath As String
NewFolderPath = "C:\Users\muhar\Desktop\fso"
Set fso = New Scripting.FileSystemObject
If Not fso.FolderExists(NewFolderPath) Then
fso.CreateFolder NewFolderPath
End If
fso.CopyFile Source:="C:\Users\muhar\Desktop\varia\Automation\VBA Script\Oefen_excel.xls", Destination:="C:\Users\muhar\Desktop\fso" & "\VBA"
Application.DisplayAlerts = True
End Sub
Last edited by a moderator: