Creates an array of Constants object names and values.
ObjectConstToArray( constants )
(r) constants reference constants object reference.
(a) constants array two dimensional array of constants names and values.
ObjectConstToArray creates an array that contains the textual names and numeric values of a constants object:
adoApp = ObjectCreate("ADODB.Connection")
adoConst = ObjectConstantsGet(adoApp)
aConstants = ObjectConstToArray(adoConst)
This function can be used during the script writing process to examine the contents of a constants object obtained using the ObjectConstantsGet function.
Note: Refer to the ObjectContantsGet documentation for details about constants object.
The returned array has two dimensions. There is one row for each constant and two columns for each row. The first column contains the string name of a constant and the second column contains the value of the constant. The name is the same one used following the dot (.) in the constants.name syntax and the value is the same one returned by constants.name.
In addition, row zero column zero of the array contains the number of constants stored in the array. Using the example above, the number of constants is obtained with:
nNumberOfConstants = aConstants[0,0]
The name of the first constant stored in the array is accessed with:
sName = aConstants[1,0]
And the first value is accessed with:
nValue = aConstants[1,1]
This example uses the ObjectConstToArray function To create an array of the constants associated with the "Excel.Application" object. The contents of the array are Then displayed In a Message box, one row at a time. ; Get the Excel application object. objXL = ObjectCreate("Excel.Application") ; Get the constants object. constXL = ObjectConstantsGet(objXL) ; Create an array of constants. aXL = ObjectConstToArray(constXL ) ; Display each name and value. ; (There are over 1500 of them.) For i = 1 To aXL[0,0] sTittle = StrCat(" Constant No. ", i) sText = StrCat( aXL[i,0], " = ",aXL[i,1] ) Message( sTittle, sText) Next ; Clean up. constXL = 0 objXL = 0