【发布时间】:2018-08-14 01:12:18
【问题描述】:
我编写了一个 VBA 代码来将文件从一个目录复制到另一个目录;但我不知道为什么它不起作用。有任何想法吗?我知道如何使用 FileSystemObject 来做,但我想学习——用 SHELL 来做。
Sub copy_file()
Dim dirPath As String, srcFile As String
dirPath = "E:\Download\"
srcFile = ThisWorkbook.Path & "\" & ThisWorkbook.Name
Shell ("cmd /c copy /y """ & srcFile & " " & dirPath & """")
End Sub
【问题讨论】:
-
“不工作” - 这是什么意思?发生了什么事?