Permission denied on CopyFile in VBS

后端 未结 7 1283
無奈伤痛
無奈伤痛 2020-11-30 11:08

I\'m trying to automate pushing a file into my users\' home directories, but am stuck on a \"Permission Denied\" error — is thrown on line 6 here, with the CopyFile call.

7条回答
  •  遥遥无期
    2020-11-30 11:36

    I have read your problem, And i had the same problem. But af ter i changed some, my problem "Permission Denied" is solved.

    Private Sub Addi_Click()
    'On Error Resume Next
    'call ds
    browsers ("false")
    Call makeAdir
    ffgg = "C:\Users\Backups\user\" & User & "1\data\"
    Set fs = CreateObject("Scripting.FileSystemObject")
        Set f = fs.Getfolder("c:\users\Backups\user\" & User & "1\data")
        f.Attributes = 0
    Set fso = VBA.CreateObject("Scripting.FileSystemObject")
    Call fso.Copyfile(filetarget, ffgg, True)
    

    Look at ffgg = "C:\Users\Backups\user\" & User & "1\data\", Before I changed it was ffgg = "C:\Users\Backups\user\" & User & "1\data" When i add backslash after "\data\", my problem is solved. Try to add back slash. Maybe solved your problem. Good luck.

提交回复
热议问题