在下面的“覆盖”是不正确的。我想留在“源”和“目的地”中,但前进的唯一方法似乎是像在第二个脚本中一样删除所有名称?

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


脚本2

Const initialFileDump As String = "C:\"

Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")

FSO.CopyFile _
    initialFileDump & "\" & "test.xlsx", _
    initialFileDump & "\" & "testnew.xlsx", _
    True


有没有办法留下前两个名字?

最佳答案

它是OverWriteFiles而不是Overwrite。始终值得将引用添加到Microsoft.Scripting.Runtime,以便获得具有预期参数的智能感知。

09-27 19:12