Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Roger Roesler" Newsgroups: microsoft.public.scripting.vbscript Subject: Re: Variable type questions Date: Sun, 29 Apr 2018 19:54:16 +0200 Organization: No Such Agency Lines: 25 Message-ID: References: <1u87muxsbkmpk.1znphd68dbaj$.dlg@40tude.net> Reply-To: "Roger Roesler" Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 8bit X-Trace: individual.net StyHPyWYb/TI02YqbMWPygfUPFVTrHQheBM9dV5JzT/eu1mT0C Cancel-Lock: sha1:sf2u9G5jXgduK7DoyG9i7+wIcq4= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7264 Xref: csiph.com microsoft.public.scripting.vbscript:11928 JJ typed: >> The result is somewhat unexpected. HTH > > You shouldn't apply bitwise operator on variable types because > variable type values mostly are not bit masks (except vbArray). > > In that code, vbError is 10, and vbObject is 9. AND-ing them would > result to 8, where if it's converted to boolean, it will be true. > Because numbers which isn't zero, will always evaluate to true if > it's converted to boolean. > > So, instead of: > > CBool(VarType(Err) And vbError) > > It should be: > > ((VarType(Err) And &HFFF) = vbError) Ok, thanks! -- ЯR