How to access verbose enum/constant values?

  • Thread starter Thread starter kiln
  • Start date Start date
K

kiln

Does anyone know how to get the verbose value of a constant's values?
For instance, I'm working with the OWC10 pivot table. The ViewChange
event has many Reason params, which return an integer. I'd like to
debug.print the verbose value of the enum, for instance

plViewReasonAlignmentChange

rather than the integer it represents (18) so I can figure out what is
firing when.
 
---------- kiln said:
Does anyone know how to get the verbose value of a constant's values?
For instance, I'm working with the OWC10 pivot table. The ViewChange
event has many Reason params, which return an integer. I'd like to
debug.print the verbose value of the enum, for instance

plViewReasonAlignmentChange

rather than the integer it represents (18) so I can figure out what is
firing when.

kiln,

I guess you can find the params in the object browser in the VBE. Do a
search for ViewChange and/or plViewReasonAlignmentChange and see what
it returns. For ViewChange you should see the list of all params.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
I know how see the enum values in the VBE editor; I am looking for a way
to return the verbose enum name. I think you didn't read the origianl
request very carefully.
 
AFAIK there isn't a built-in VBA function for this (nor has there been
in any other language I've ever used).
 
---------- kiln said:
I know how see the enum values in the VBE editor; I am looking for a way
to return the verbose enum name. I think you didn't read the origianl
request very carefully.


There's nothing about using a function, only about figuring out.
However, John already wrote there is no built in function. So if you
really need the names, you'll have to write your own function
returning the verbose name, something like this:

Public Function strVerboseNameParam(ByVal lngValue As Long) As String

Select Case lngValue
Case plViewReasonAlignmentChange 'or Case 18
strVerboseNameParam = "plViewReasonAlignmentChange"
' Case ...
End Select
End Function

For this you'll have to pick the values and names from the VBE object
browser.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Back
Top