检查 Variant 值“Nothing" [英] Checking for the Variant value "Nothing"

查看:18
本文介绍了检查 Variant 值“Nothing"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我去年遇到的事情,所以似乎是记录它的好地方:)

This is something I ran into last year, and SO seems like a good place to document it :)

问:从 Delphi 自动化 Excel (/Word/...) 时,如何检查 Excel 函数是否返回了变体 Nothing(在 VBA 中调用)?

Q: When automating Excel (/Word/...) from Delp how can I check if an Excel function returned the variant Nothing (as it's called in VBA)?

推荐答案

VarIsClear 函数包括类型为 varDispatch 且值为 nil 的情况.它还包括空值和未知"值,以及自定义变体类型.我在我的 Delphi 2005 源代码中看到了它;我不知道它提前多久被收录.

The VarIsClear function includes your situation where the type is varDispatch and the value is nil. It also includes empty and "unknown" values, and custom variant types. I see it in my Delphi 2005 source; I don't know how much earlier it was included.

这篇关于检查 Variant 值“Nothing"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆