【发布时间】:2013-10-16 07:33:08
【问题描述】:
我有这个代码:
Sub MoveFiles()
Dim d As String, ext, x
Dim srcPath As String, destPath As String, srcFile As String
srcPath = "C:\test\"
destPath = "C:\test2\"
ext = Array("*.csv", "*.xls")
For Each x In ext
d = Dir(srcPath & x)
Do While d <> ""
srcFile = srcPath & d
FileCopy srcFile, destPath & d
Kill srcFile
d = Dir
Loop
Next
End Sub
但它会删除 srcPath 中的每个文件。我只需要它来删除 activeworkbook.name 而不是每一个。 我想了好一个小时这段代码,但不知道如何让它不循环,仍然做它应该做的事情。
感谢您对此的帮助
【问题讨论】:
-
i only need it to delete activeworkbook.name and not every single one.如果您正在从中运行代码,如何删除活动工作簿? -
因为它已经将它保存到另一个地方。我刚刚指定了名称