Export (0) Print
Expand All

Constants Property

Office 2003

Returns an object that allows script users to use named constants. Read-only.

For more information, see Using Named Constants in VBScript .

This property is required only on HTML pages. In other containers (such as Visual Basic), you can use defined constants from the object model directly, without first using the Constants property. Using the Constants property in other containers will work but is not recommended, as it will cause your code to run significantly slower.

expression.Constants

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example adds a medium-weight green border to each cell in the range B5:C10 on the spreadsheet. Because named constants are not available in VBScript, the example sets a variable to the object returned by the Constants property.

Sub SetBorder()
    Dim ssConstants
 
    ' Set a variable to the constants of the Spreadsheet component.  
    Set ssConstants = Spreadsheet1.Constants
    
    ' Set the border weight.
    Spreadsheet1.Range("b5:c10").Borders.Weight = ssConstants.owcLineWeightMedium
    
    ' Set the border color.
    Spreadsheet1.Range("b5:c10").Borders.Color = "green"
End Sub

		




Show:
© 2014 Microsoft