Thread
:
Convert String Representation of Excel Constant to Actual Value
View Single Post
#
2
Posted to microsoft.public.excel.programming
Dave Peterson
external usenet poster
Posts: 35,218
Convert String Representation of Excel Constant to Actual Value
If you're looking for a single value,
you can open the VBE
hit ctrl-g (to see the immediate window)
and type this:
?xltextformat
You can also search the Object Browser:
In the VBE
Hit F2 to show that object browser.
search for xlColumnDatatype
Select each of the option and at the bottom of the screen you'll see the values.
Or you could download Chip Pearson's cross reference:
http://www.cpearson.com/excel/download.htm
Look for XLConst
wrote:
I'm importing a fixed width text file into another workbook using
workbooks.opentext and would like to store all the setup info for this
process in a table within an Excel sheet so the user can change the
setup when they need to.
At the moment, I have columns for Field Headings (text), Field Format
(being the text for xlColumnDataTypes), and start position (integer).
When I read the data in however, the FieldInfo is expecting an integer
Excel constant (eg xlTextFormat or 2), rather than the text of this
(eg "xlTextFormat").
Is there a way to convert from a string representation of an Excel
constant to the constant's actual value?
I thought of using Evaluate (but that's only for cell/range
references) or CInt (doesn't work either). I'm kludging it at the
moment by doing a vlookup and getting the appropriate integer value
that way but surely there's a more elegant solution?
Any ideas?
tia
Jeff
--
Dave Peterson
Reply With Quote
Dave Peterson
View Public Profile
Find all posts by Dave Peterson