Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Constant Failure? Don't Do That!

Most things in VB4, including the VBA and VB engines, are OLE objects. In some cases, objects can expose properties or methods with the same name as in another object. Theoretically, the object that is highest in the references list will take priority, and the VBA and VB objects will take priority over any add-ins. But if 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 nothing else is obviously wrong, try prefixing it with VB or VBA (VBA.Left$ instead of Left$). Note that this should not happen in the case of the VBA and VB objects, but it does.

Also, it is possible to redefine the built-in VB and VBA constants to some other value, and you will get no compile error. But when you actually use the redefined constant, it will fail in some really neat ways. As the doctor said to the patient who reported a pain when he raised his arm above his head, "Then don't do that."

L.J. Johnson
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date