sig*_*gil 3 excel vba excel-vba
我想IsEmpty()在这样的类中创建一个本地版本:
Public Dict As Dictionary
Public Function isEmpty(columnName As Variant) As Boolean
isEmpty = IsEmpty(Dict(columnName))
End Function
Run Code Online (Sandbox Code Playgroud)
这是为了隐藏信息,以便我可以打电话
classInstance.isEmpty("someField")
Run Code Online (Sandbox Code Playgroud)
代替
isEmpty(classInstance.Dict("someField"))
Run Code Online (Sandbox Code Playgroud)
因此不会暴露类的内部数据结构.
但问题是isEmpty()我声明的版本似乎覆盖了对VBA库版本的任何引用IsEmpty(),因为它生成Out of stack错误并导致Excel崩溃.我假设这是因为isEmpty = IsEmpty(...)调用导致无限递归.
有没有办法可以明确地引用IsEmpty()我想在这里调用的标准版本?
是.明确引用标准库.
VBA.IsEmpty()
Run Code Online (Sandbox Code Playgroud)
奖励:
IsEmpty实际上属于Information对象.一个完全显式调用看起来是这样的.
bool = VBA.Information.IsEmpty(var)
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
346 次 |
| 最近记录: |