Constant Failure? Don’t Do That!

Most things in VB4, including the VBA and VB engines, are OLEobjects. In some cases, objects can expose properties or methodswith the same name as in another object. Theoretically, the objectthat is highest in the references list will take priority, andthe VBA and VB objects will take priority over any add-ins. Butif you do run into this problem, the solution is easy. For example,if a built-in VB or VBA function doesn’t seem to work and nothingelse is obviously wrong, try prefixing it with VB or VBA (VBA.Left$instead of Left$). Note that this should not happen in the caseof the VBA and VB objects, but it does.

Also, it is possible to redefine the built-in VB and VBA constantsto some other value, and you will get no compile error. But whenyou actually use the redefined constant, it will fail in somereally neat ways. As the doctor said to the patient who reporteda pain when he raised his arm above his head, “Then don’tdo that.”

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: