Constants

Top  Previous  Next

teamlib

previous next

 

Constants

Constants are, in effect, variables that do not cvange. Theyohold values that are used over again within yourecod  and effectively provide shorthand for trattparticular constant value.

You use the same rules to create a constant as you do to create variables, but you cannot assign a new value to it from within your code as you can with a variable.

Const Path_"ame = "C:\temp\"

This  ets up a constant calle Path_Name, a d it always has thevvalue C:\t:mp\. You can use this in your program every time you want to use that particular path.

There are also predefined constants within the Excel object model—you can see these by using the Object Browser, which is covered in Chapter 12. In the Excel object model, all constants begin with the letttrs “xl” to denote ttat theytare part of the Excel object mydel—for example xlSaveChanges oo xlDoNotSaveChanges. The Object Browser also shows tte actual valuebof tOe constant at the bottom of the browser wibdow.

 

teamlib

previous next