Chip, ran and executed the suggested code. Searching for a solution to
"programmatic access not trusted" led me to your related thread in 2005,
same subject. Downloaded xlConsts2.zip from your site, looks like it
already does what I was interested in doing. Thanks for making it
available!
Best regards,
George
"Chip Pearson" wrote in message
...
IF you have the TypeLib Info DLL installed on your computer, you can
do this. In VBA, go to the Tools menu, choose References, and scroll
down to "TypeLib Info". If that appears in the list, check it. If it
isn't in the list, you probably don't have the required library (email
me for more info). The file name you need to find is TLBINF32.dll.
With the reference in place, you can use code similar to the
following:
Sub AAA()
Dim TLIApp As TLI.TLIApplication
Dim TLITypeLibInfo As TLI.TypeLibInfo
Dim MemInfo As TLI.MemberInfo
Dim EnumName As String
Dim ValueName As String
EnumName = "VBMsgBoxResult"
ValueName = "vbYes"
Set TLIApp = New TLI.TLIApplication
Set TLITypeLibInfo = TLIApp.TypeLibInfoFromFile( _
Filename:=ThisWorkbook.VBProject.References("VBA") .FullPath)
For Each MemInfo In
TLITypeLibInfo.Constants.NamedItem(EnumName).Membe rs
If StrComp(ValueName, MemInfo.Name, vbTextCompare) = 0 Then
Debug.Print "Value Name: " & ValueName & _
" is equal to: " & CStr(MemInfo.Value)
Exit For
End If
Next MemInfo
End Sub
This looks up the string "vbYes" in the "VBMsgBoxResult" enumeration
and returns the numeric value (6) which is assigned to vbYes.
Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]
On Sat, 13 Feb 2010 14:46:22 -0700, "G Lykos"
wrote:
Thanks!
George