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:
ExcelApp.Workbooks.OpenText(Filename:=ACFileName, _
StartRow:=1, DataType:=Excel.XlTextParsingType.xlFixedWidth, _
FieldInfo:=
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.
Syntax
Array(arglist)
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.
Example:
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.
David Walker