您好,我希望能够在没有权限的情况下将excel文件复制到文件夹中。
Sub CopyFile()
Dim Folder As String, FileSource As String, FileTarget As String
Folder = "W:\BusIntegration\" & "\"
FileSource = Folder & "excel.xlsx"
FileTarget = "W:\branch\excel.xlsx"
FileCopy FileSource, FileTarget
End Sub
W:\ branch要求具有访问权限
感谢您的帮助
权限被拒绝错误通常是文件路径错误,文件正在使用或处于锁定状态的情况。
查看您的代码,Folder
变量可能由于双倍\
而引起错误
Folder = "W:\BusIntegration\" & "\"
FileSource = Folder & "excel.xlsx"
'This will return "W:\BusIntegration\\excel.xlsx"
代替尝试
Folder = "W:\BusIntegration\"
FileSource = Folder & "excel.xlsx"
'This will return "W:\BusIntegration\excel.xlsx"