Search notes:
Microsoft.Office.Interop.….Constants (enum)
For each
Office application like
Excel or
Access, there is a corresponding
enum that stores the appllication's
global constants.
The following example demonstrates how the constants of Excel can be read:
[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Excel")
$xlsConstants = [Microsoft.Office.Interop.Excel.Constants]
$xlsConstants.DeclaredMembers | foreach-object {
if ($_.name -ne 'value__') {
' {0,-30} {1,5}' -f $_.name, $xlsConstants.GetDeclaredField($_.name).GetRawConstantValue()
}
}
The value of a constant with a given name can be accessed like so:
[Microsoft.Office.Interop.Excel.Constants].GetDeclaredField('xlVeryHidden').GetRawConstantValue()
I am not sure if there is a shorter way to achieve this.