Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a VBA function that will return the string name of a vba
constant from its number? x = f(-4108) would return xlVAlignCenter Thanks Fred Holmes |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There isn't a 1 to one mapping of numbers and strings in the application
context. If you check in the object browser you will see that (for example) that both "ap3D" (appearances) and "raNone" (arrowtypes) have a value of 1. So you would also somehow have to define the specific context for your constant. Tim. "Fred Holmes" wrote in message ... Is there a VBA function that will return the string name of a vba constant from its number? x = f(-4108) would return xlVAlignCenter Thanks Fred Holmes |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don't think so Fred. Problem is that some number could be many constants,
such as 2 is xlBIFF, xlPublisher, xlMove, xlWIndows, etc., etc. -- HTH RP (remove nothere from the email address if mailing direct) "Fred Holmes" wrote in message ... Is there a VBA function that will return the string name of a vba constant from its number? x = f(-4108) would return xlVAlignCenter Thanks Fred Holmes |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I set the context?
Dim cfv cfv = ActiveCell.VerticalAlignment MsgBox "Vertical Alignment is " & cfv The above returns the message "Vertical Alignment is -4108" I'd like to get to "Vertical Alignment is xlVAlign Center" Thanks, Fred Holmes On Fri, 4 Feb 2005 14:07:24 -0800, "Tim Williams" <saxifrax at pacbell dot net wrote: There isn't a 1 to one mapping of numbers and strings in the application context. If you check in the object browser you will see that (for example) that both "ap3D" (appearances) and "raNone" (arrowtypes) have a value of 1. So you would also somehow have to define the specific context for your constant. Tim. "Fred Holmes" wrote in message .. . Is there a VBA function that will return the string name of a vba constant from its number? x = f(-4108) would return xlVAlignCenter Thanks Fred Holmes |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You have just been told twice that you don't.
-- HTH RP (remove nothere from the email address if mailing direct) "Fred Holmes" wrote in message ... How do I set the context? Dim cfv cfv = ActiveCell.VerticalAlignment MsgBox "Vertical Alignment is " & cfv The above returns the message "Vertical Alignment is -4108" I'd like to get to "Vertical Alignment is xlVAlign Center" Thanks, Fred Holmes On Fri, 4 Feb 2005 14:07:24 -0800, "Tim Williams" <saxifrax at pacbell dot net wrote: There isn't a 1 to one mapping of numbers and strings in the application context. If you check in the object browser you will see that (for example) that both "ap3D" (appearances) and "raNone" (arrowtypes) have a value of 1. So you would also somehow have to define the specific context for your constant. Tim. "Fred Holmes" wrote in message .. . Is there a VBA function that will return the string name of a vba constant from its number? x = f(-4108) would return xlVAlignCenter Thanks Fred Holmes |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Fred
This isn't simple, but here's a way: First dowload this workbook from Chip's site http://www.cpearson.com/Zips/TLIUtils.ZIP (or navigate to http://www.cpearson.com/excel.htm and about 2/3 the way down look for Download XLTLI - Type Lib Utilities) Then, at the bottom of the standard module, put this code Sub CCC() Dim i As Long Dim v As Collection Set v = EnumValuesFromEnumGroup("XLValign", SearchXL) For i = 1 To v.Count Debug.Print v(i).ItemName, v(i).ItemValue Next i End Sub You'll see all the enum names and values of type xlvalign. Now you just need to work this into a function, which should be pretty easy. Post back if you need more help, though. -- Dick Kusleika Excel MVP Daily Dose of Excel www.dicks-blog.com Fred Holmes wrote: Is there a VBA function that will return the string name of a vba constant from its number? x = f(-4108) would return xlVAlignCenter Thanks Fred Holmes |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return Number | Excel Discussion (Misc queries) | |||
Return the Row number | Excel Discussion (Misc queries) | |||
VBA: how do I return a row number? | Excel Programming | |||
return row number | Excel Programming | |||
command to return the row number or cell number in excel? | Excel Programming |