View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default xlConstants to numbers?

Oops I forgot one step

Alt F11
Ctrl g

Type this in the Immediate window
?xlDialogActivate
And press Enter

You see the number now


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Charlotte E." <@ wrote in message ...
Maybe you like XLConst on Chip's download page
http://www.cpearson.com/excel/download.htm


Well, running the macros still brings me the problem with the TypeLib
reference, but the sheets at least contains the xlContants :-)

Thanks...


CE







"Peter T" <peter_t@discussions wrote in message
...
Is is possible to get this converted into the number of the
xlConstant?
you'd need to programmatically write code to a module

But you can get one or all of the constants directly from Excel's
typelib Sub dumpConstants()
''' with a reference to TypLib Information
'Dim oTLI As TLI.TLIApplication
'Dim oInfo As TLI.TypeLibInfo
'Dim oConst As TLI.ConstantInfo
'Dim oMembers As TLI.Members

''' without the reference use As Object
Dim oTLI As Object
Dim oInfo As Object
Dim oConst As Object
Dim oMembers As Object

Dim i As Long, c As Long

Set oTLI = CreateObject("TLI.TLIApplication")
Set oInfo = oTLI.TypeLibInfoFromFile(Application.Path &
"\Excel.exe") For Each oConst In oInfo.Constants
i = i + 1
Cells(i, 1) = oConst.Name
Set oMembers = oConst.Members
For c = 1 To oMembers.Count
i = i + 1
Cells(i, 2) = oMembers(c).Name
Cells(i, 3) = oMembers(c).Value
Next
Next

Columns("A:C").EntireColumn.AutoFit
End Sub

Regards,
Peter T


"Charlotte E." <@ wrote in message
...
In a cell, say "B3", I have one of the VBA xlConstants as written
text, say 'xlDialogActivate'.

Is is possible to get this converted into the number of the
xlConstant? I've tried...


MsgBox Evaluate(Range("B3").value)


But with no luck :-(


Any other way to get this done?


TIA,

CE