检查变量值"没有" [英] Checking for the Variant value "Nothing"

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

问题描述

这是我碰到了,去年和SO似乎是一个好地方,记录它:)

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

问:当德尔福自动化Excel(/字/ ...),我怎么能检查,如果一个Excel函数返回的变量没有(因为它被称为在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 和值。它还包括空和未知的价值观,以及自定义变量类型。我看到它在我的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.

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

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