简体   繁体   English

编译错误:参数不是可选的

[英]Compile Error: Argument Not Optional

I have the following function: 我有以下功能:

Public Function getModuleAndEsnRange(fromSheetName As String, toSheetName As String, modulesColumn As Integer, firstModuleRow As Integer, esnsRow As Integer, firstEsnColumn As Integer) As String

    ...[code]...

    'returns the value
    getModuleAndEsnRange = moduleAndEsnRange

End Function

Elsewhere in the same module I call: 我在同一模块中的其他地方调用:

test = getModuleAndEsnRange(SHEET_WIP.Name, SHEET_WIP_DATA.Name, 1, 5, 3, 3)

And a box pops up that says "Compile Error: Argument Not Optional". 然后弹出一个框,提示“编译错误:参数不是可选的”。 It highlights in yellow the "Public Function getM... As String" and highlights in blue the "test = getM . . . 3, 3)" 它以黄色突出显示“ Public Function getM ... As String”,并以蓝色突出显示“ test = getM。。。3,3)”

What am I doing wrong? 我究竟做错了什么? I have all 6 arguments listed when I call the function. 调用函数时,列出了所有6个参数。 . .

Check to see if SHEET_WIP.Name and SHEET_WIP_DATA.Name are string values. 检查SHEET_WIP.NameSHEET_WIP_DATA.Name是否为字符串值。 It may be that one of them is null 可能其中之一为null

Turns out I had another function inside of the code I had not listed. 原来我没有列出的代码中还有另一个函数。 The function inside the code did not have the appropriate matching arguments. 代码中的函数没有适当的匹配参数。

Thank you all! 谢谢你们!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM