VBA“编译错误:参数不可选”调试子

时间:2015-06-29 12:47:10

标签: excel vba excel-vba excel-2010

我正在尝试调试这段简单的代码:

Public Sub FunctionNotValidVarType()
MsgBox "VarType " & VarType & " is not supported. Please check spelling."
End Sub

1 个答案:

答案 0 :(得分:2)

Public Sub FunctionNotValidVarType()
Dim variable As Integer
variable = 2
MsgBox "VarType " & VarType(variable) & " is not supported. Please check spelling."
End Sub

您需要调用VarType函数向其传递实际变量