
Signature
macropod
[MVP - Microsoft Word]
-------------------------
> True, a purist might use something like:
That's belittling.
> Sub Test()
> Dim iNum As Integer
[quoted text clipped - 3 lines]
> MsgBox sNum
> End Sub
Maybe you're a newb, in which case such arrogance is understandable, but it wasn't
until VB4's introduction of Evil Type Coercion that such an assignment would fail to
generate a "Type Mismatch" error. Survivors in the crowd know better than to trust
default behaviors.
> As for automatic conversions, I've heard much the same line about automatic
> transmissions in cars...
I was listening to Car Talk on NPR a few weeks ago, and some poor slob called in
with a sob story that's perhaps appropos. Seems he'd bought a "4-speed" car (forget
what make/model) a few years ago, and had driven it happily all this time. Well, lo
and behold, turns out now that it's actually a 5-speed tranny, and the last owner
had apparently swapped gear knobs (to one that only diagrammed 4 gears, rather than
all 5) at some point. Oh how silly this guy felt. Shoulda heard the Tappet
brothers laugh. Hell, I even felt sorry for the guy.

Signature
.NET: It's About Trust!
http://vfred.mvps.org
macropod - 29 Mar 2007 23:16 GMT
Hi Karl,
It wasn't meant to be belittling, but I can't see how using the automatic type conversion tools built into vba in any riskier than
doing it manually - regardless of what happened with an app (vb3) that was superseded over a decade ago.
If there is a material risk doing this in vba, please say what it is. AFAIK, all vba implementations support it.
Regards

Signature
macropod
[MVP - Microsoft Word]
-------------------------
>> True, a purist might use something like:
>
[quoted text clipped - 20 lines]
> diagrammed 4 gears, rather than all 5) at some point. Oh how silly this guy felt. Shoulda heard the Tappet brothers laugh.
> Hell, I even felt sorry for the guy.
Karl E. Peterson - 29 Mar 2007 23:26 GMT
> It wasn't meant to be belittling, but I can't see how using the automatic type
> conversion tools built into vba in any riskier than doing it manually -
> regardless of what happened with an app (vb3) that was superseded over a decade
> ago.
> If there is a material risk doing this in vba, please say what it is. AFAIK, all
> vba implementations support it.
As we found in the VB3/VB4 transition days, the real risk was in trusting default
behaviors to remain consistent through time. As things stand, ClassicVB is now
probably *the* most stable language on the planet, eh? <g> But that doesn't mean
VBA isn't subject to some "cleaning up" in the future. The bottom line is, if you
don't depend on default behaviors (automatic coercions, default properties, and so
on), your code can't change behavior in future versions just because some young pup
at MSFT (probably sitting on a copy of Code Complete, so he can reach the keyboard)
decides that VBA could be cooler if only [fill-in-the-blank]. Is it a material
risk? Considering the history (see my sig), it's only immaterial if you consider
your code to be disposable.

Signature
.NET: It's About Trust!
http://vfred.mvps.org