Intrinsic Constants

In addition to allowing you to define your own constants using the Const keyword, VBA includes a number of built-in or intrinsic constants whose values are predefined by VBA. Along with saving you from having to define these values as constants, the major advantage of using intrinsic constants is that they enhance the readability of your code. So, for instance, instead of having to write code like this:

If myObject.ForeColor = &hFFFF Then you can write:

If myObject.ForeColor = vbYellow Then

Intrinsic constants are now available for most operations. The best place to find information about the available intrinsic constants is in the VB object browser, which you can open by selecting Object Browser from the View menu or by pressing F2. In many cases, though, a list of available constants for a particular operation will pop up as you are entering the code. Appendix B, Language Constants, also lists constants available in VB and VBA.

Intrinsic Constants 53

Was this article helpful?

0 0

Responses

  • massimo
    How do I include intrinsic constants in vba?
    8 years ago
  • charlie duncan
    What are the VB instristic constant?
    8 years ago
  • ROBERT
    What is intrinsic in visual basic?
    3 months ago

Post a comment