未找到命名参数

时间:2015-01-23 12:50:24

标签: excel vba methods arguments

在以下"覆盖"是不正确的。我想留下"来源"和"目的地"但似乎唯一的出路是在第二个脚本中删除所有名称?

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

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

1 个答案:

答案 0 :(得分:3)

它是OverWriteFiles而不是Overwrite。总是值得添加对Microsoft.Scripting.Runtime的引用,以便您获得具有预期参数的智能。

enter image description here