The Is Operator

     

When you looked at comparison operators in the last chapter, the operands you used were simple numbers and strings. Indeed, most of the comparison operators don't make sense in the context of objects (for example, it's absurd to think of one object being "greater than" another). However, VBA does have a comparison operator specifically for objects ”the Is operator:

  result  =  Object1  Is  Object2  
graphics/note_icon.gif

When you want to specify colors in VBA, use the RGB function:

 RGB(red, green, blue) 

red

An integer value between 0 and 255 that represents the red component of the color .

green

An integer value between 0 and 255 that represents the green component of the color.

blue

An integer value between 0 and 255 that represents the blue component of the color.


Here, Object1 and Object2 are objects or Object variables . If they're the same, result takes the value True; otherwise , result is False.



Absolute Beginner's Guide to VBA
Absolute Beginners Guide to VBA
ISBN: 0789730766
EAN: 2147483647
Year: 2003
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net