469,658 Members | 1,862 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,658 developers. It's quick & easy.

Array function from VBA

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
Jun 18 '06 #1
0 1714

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Tweaxor | last post: by
7 posts views Thread by Jim Carlock | last post: by
4 posts views Thread by assgar | last post: by
14 posts views Thread by Abhi | last post: by
9 posts views Thread by =?Utf-8?B?RGFya21hbg==?= | last post: by
26 posts views Thread by aruna.mysore | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.