<div dir="ltr"><br><div class="gmail_extra">Thank you for commenting.<br><br><div class="gmail_quote">2014-04-29 21:30 GMT+08:00 Piotr Caban <span dir="ltr"><<a href="mailto:piotr.caban@gmail.com" target="_blank">piotr.caban@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On 04/29/14 15:06, Shuai Meng wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+    if(!res)<br>
+        return S_OK;<br>
</blockquote>
You can't return early if res is NULL. You still need to do the conversion and return error if it fails.<br></blockquote><div>I  don't quite get it, do you mean I should do like this:</div><div>if(res)</div><div>
{</div><div>....</div><div>}</div><div>return S_OK;</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+Call ok(CBool(Empty) = False, "CBool(Empty) = " & CBool(Empty))<br>
+Call ok(getVT(CBool(Empty)) = "VT_BOOL", "getVT(CBool(Empty)) = " & getVT(CBool(Empty)))<br>
+Call ok(CBool(1) = True, "CBool(1) = " & CBool(1))<br>
+Call ok(getVT(CBool(1)) = "VT_BOOL", "getVT(CBool(1)) = " & getVT(CBool(1)))<br>
+Call ok(CBool(0) = False, "CBool(0) = " & CBool(0))<br>
+Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0)))<br>
+Call ok(CBool(-0.56) = True, "CBool(-0.56) = " & CBool(-0.56))<br>
+Call ok(getVT(CBool(-0.56)) = "VT_BOOL", "getVT(CBool(-0.56)) = " & getVT(CBool(-0.56)))<br>
+Call ok(CBool("-1") = True, "CBool(""-1"") = " & CBool("-1"))<br>
+Call ok(getVT(CBool("-1")) = "VT_BOOL", "getVT(CBool(""-1"")) = " & getVT(CBool("-1")))<br>
</blockquote>
It would be nice to add following tests (these are the tests Jacek was asking for):</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Call ok(CBool("True") = true, "CBool(""True"") = " & CBool("True"))<br>
Call ok(CBool("fAlSe") = false, "CBool(""fAlSe"") = " & CBool("fAlSe"))<br></blockquote><div><br></div><div> I do notice it, but they failed in testbot. Just as MSDN says, <span style="font-size:13px;color:rgb(42,42,42);font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif;line-height:18px">If </span><em style="font-size:13px;color:rgb(42,42,42);font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif;line-height:18px">expression</em><span style="font-size:13px;color:rgb(42,42,42);font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif;line-height:18px"> can't be interpreted as a numeric value, a run-time error occurs.</span></div>
<div><span style="font-size:13px;color:rgb(42,42,42);font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif;line-height:18px"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

sub testCBoolError<br>
    on error resume next<br>
<br>
    call Err.clear()<br>
    call CBool("#FALSE#")<br>
    call ok(Err.number = 458, "Err.number = " & Err.number)<br>
end sub<br>
Call testCBoolError<br>
<br></blockquote><div>Is this function written to provoke an error on purpose in order to test CBool("#FALSE#")? Can CBool("True") assume the same form? Because CBool("True") always fails in testbot as I have said.</div>
</div><br></div></div>