ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FieldInfo (https://www.excelbanter.com/excel-programming/304113-fieldinfo.html)

GPO[_2_]

FieldInfo
 
Excel 2000

I am importing a tab delimited file and every column must
be set to "text". Is there a more
efficient/economical/shorter way of representing the array
of arrays that field info requires? It just seems a but
verbose.

Below is a snippet. Apologies for the wrapping but you get
the idea.
..
..
..
FieldInfo:=Array( _
Array(1, 2), Array(2, 2), Array(3, 2), Array
(4, 2), Array(5, 2), Array(6, 2), Array(7, 2), Array(8,
2), Array(9, 2), Array(10, 2), _
Array(11, 2), Array(12, 2), Array(13, 2), Array
(14, 2), Array(15, 2), Array(16, 2), Array(17, 2), Array
(18, 2), Array(19, 2), Array(20, 2), _
Array(21, 2), Array(22, 2), Array(23, 2), Array
(24, 2), Array(25, 2), Array(26, 2), Array(27, 2), Array
(28, 2), Array(29, 2), Array(30, 2), _
Array(31, 2), Array(32, 2), Array(33, 2), Array
(34, 2), Array(35, 2), Array(36, 2), Array(37, 2), Array
(38, 2), Array(39, 2), Array(40, 2), _
Array(41, 2), Array(42, 2), Array(43, 2), Array
(44, 2), Array(45, 2), Array(46, 2), Array(47, 2), Array
(48, 2), Array(49, 2), Array(50, 2), _
Array(51, 2), Array(52, 2), Array(53, 2), Array
(54, 2), Array(55, 2), Array(56, 2), Array(57, 2), Array
(58, 2), Array(59, 2), Array(60, 2), _
Array(61, 2), Array(62, 2), Array(63, 2), Array
(64, 2), Array(65, 2), Array(66, 2), Array(67, 2), Array
(68, 2), Array(69, 2), Array(70, 2), _
Array(71, 2), Array(72, 2), Array(73, 2), Array
(74, 2), Array(75, 2), Array(76, 2), Array(77, 2), Array
(78, 2), Array(79, 2), Array(80, 2), _
Array(81, 2), Array(82, 2), Array(83, 2), Array
(84, 2), Array(85, 2), Array(86, 2), Array(87, 2), Array
(88, 2), Array(89, 2), Array(90, 2), _
Array(91, 2), Array(92, 2), Array(93, 2), Array
(94, 2), Array(95, 2), Array(96, 2), Array(97, 2), Array
(98, 2))
..
..
..

Regards

GPO

keepITcool

FieldInfo
 


you'll still need to know the number of columns..
but then you can shorten it to:

Dim i, va(97) 'assuming option base 0
For i = LBound(va) To UBound(va)
va(i) = Array(i, 2)
Next

Workbooks.OpenText Filename:="D:\data.txt", _
Origin:= 437, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=True, Semicolon:=False, Comma:=False, _
Space:=False, Other:=False, _
Fieldinfo:=va


not perfect.. but it looks better :)



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"GPO" <cre@inine wrote:

Excel 2000

I am importing a tab delimited file and every column must
be set to "text". Is there a more
efficient/economical/shorter way of representing the array
of arrays that field info requires? It just seems a but
verbose.

Below is a snippet. Apologies for the wrapping but you get
the idea.
.
.
.
FieldInfo:=Array( _
Array(1, 2), Array(2, 2), Array(3, 2), Array
(4, 2), Array(5, 2), Array(6, 2), Array(7, 2), Array(8,


Array(91, 2), Array(92, 2), Array(93, 2), Array
(94, 2), Array(95, 2), Array(96, 2), Array(97, 2), Array
(98, 2))
.
.
.

Regards

GPO



GPO[_2_]

FieldInfo
 
Many thnx!
-----Original Message-----


you'll still need to know the number of columns..
but then you can shorten it to:

Dim i, va(97) 'assuming option base 0
For i = LBound(va) To UBound(va)
va(i) = Array(i, 2)
Next

Workbooks.OpenText Filename:="D:\data.txt", _
Origin:= 437, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=True, Semicolon:=False, Comma:=False, _
Space:=False, Other:=False, _
Fieldinfo:=va


not perfect.. but it looks better :)



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"GPO" <cre@inine wrote:

Excel 2000

I am importing a tab delimited file and every column

must
be set to "text". Is there a more
efficient/economical/shorter way of representing the

array
of arrays that field info requires? It just seems a but
verbose.

Below is a snippet. Apologies for the wrapping but you

get
the idea.
.
.
.
FieldInfo:=Array( _
Array(1, 2), Array(2, 2), Array(3, 2), Array
(4, 2), Array(5, 2), Array(6, 2), Array(7, 2), Array(8,


Array(91, 2), Array(92, 2), Array(93, 2),

Array
(94, 2), Array(95, 2), Array(96, 2), Array(97, 2), Array
(98, 2))
.
.
.

Regards

GPO


.



All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com