为什么VBA代码块指示“真”?条件即使条件不是这样吗? [英] Why does the VBA code block indicate a "True" condition even though the condition is not so?

查看:84
本文介绍了为什么VBA代码块指示“真”?条件即使条件不是这样吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的剧本似乎有问题。  用于验证复选框行为的附加代码块有一个语句:

I seem to have an issue with my script.  The attached block of code to verify the behavior of the checkboxes has a statement:

设置ErrorMsgWindow = DotNETForm("OSS_Stat_Imp_ErrMsg"),设置为"Nothing"。<跨度>&NBSP;
在以下条件语句块中:

Set ErrorMsgWindow=DotNETForm("OSS_Stat_Imp_ErrMsg"), which is set to "Nothing".  In the following conditional statement block:

如果ErrorMsgWindow.Exists那么

If ErrorMsgWindow.Exists Then

    ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
TestLog.Comment"不应显示此消息框。"

                TestLog.Comment "This message box should not be displayed."

ErrorMsgWindow.Attach

ErrorMsgWindow.Attach

DotNETButton("Name = btnOK")。点击

DotNETButton("Name=btnOK").Click

Else

<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
TestLog.Comment"按钮无效"

                TestLog.Comment "Button is inactive"

结束如果

属性"存在"没有值作为对象值设置为"无"。 
然而代码进入"if"条件,好像ErrorMsgWindow.Exists设置为"True",而不是。

The property "Exists" has no value as the object value is set to "Nothing".  Yet the code proceeds into the "if" conditional as if ErrorMsgWindow.Exists were set to "True", which it isn’t.

请解释并且/或建议为什么会发生这种情况以及如何重新编码以使其正常工作。 
谢谢。

Please explain and/or advise why this is happening and how this should be recoded to make it work.  Thank you.

John J. Bottiger(QA工程师,Gladiator Innovations LLC)

John J. Bottiger (QA Engineer, Gladiator Innovations LLC)

推荐答案

BTW - 附加的代码块实际上是原帖中所述的摘录。
BTW--The attached block of code is actually the excerpt stated in the original post.


这篇关于为什么VBA代码块指示“真”?条件即使条件不是这样吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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