Array function from VBA
- From: DWalker <DWalker-wk@xxxxxxxxxxxxxxxxx>
- Date: Sun, 18 Jun 2006 14:23:40 -0700
VBA, as used in Excel 2000 and Excel 2003, has a function called Array.
It's commonly seen in statements like the following:
Workbooks.OpenText Filename:=ACFileName, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 2), _
Array(9, 1), Array(18, 1), Array(33, 1), Array(49, 1), Array(71, 1), _
Array(75, 1), Array(89, 1), Array(113, 1), Array(117, 1), Array(135, 1))
The FieldInfo parameter is an array of arrays, and the inner arrays have
two items. (The values are column numbers and data types; for data type, 1
might mean text, 2 might mean date, etc. Don't hold me to that.)
I can't find how to convert this statement into VB.NET 2005. I have the
ExcelApp object of type Excel.Application, and so far I have this:
StartRow:=1, DataType:=Excel.XlTextParsingType.xlFixedWidth, _
Notice that I found how to fully qualify the xlFixedWidth constant!
Here's the doc for VBA's Array function:
Returns a Variant containing an array.
The required arglist argument is a comma-delimited list of values that are
assigned to the elements of the array contained within the Variant. If no
arguments are specified, an array of zero length is created.
Dim A As Variant
A = Array(10,20,30)
B = A(2)
How do I build the parameter list for the OpenText method?
Thanks a bunch for any help.
- Prev by Date: How to prevent DISTILLER from propting output filename ?
- Next by Date: Array function from VBA
- Previous by thread: How to prevent DISTILLER from propting output filename ?
- Next by thread: Array function from VBA