在以下"覆盖"是不正确的。我想留下"来源"和"目的地"但似乎唯一的出路是在第二个脚本中删除所有名称?
Const initialFileDump As String = "C:\"
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile _
Source:=initialFileDump & "\" & "test.xlsx", _
Destination:=initialFileDump & "\" & "testnew.xlsx", _
overwrite:=True
SCRIPT2
Const initialFileDump As String = "C:\"
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile _
initialFileDump & "\" & "test.xlsx", _
initialFileDump & "\" & "testnew.xlsx", _
True
有没有办法留下前两个名字?
答案 0 :(得分:3)
它是OverWriteFiles
而不是Overwrite
。总是值得添加对Microsoft.Scripting.Runtime
的引用,以便您获得具有预期参数的智能。