View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default Basic Q: Field/Array info when importing fixed-width text files

I recorded the following macro, which I need to be able to edit as needed to
deal with various text files.

Workbooks.OpenText Filename:= _
"C:\Documents and Settings\Me\Desktop\testdatafile1.txt", Origin:=437, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(22
_
, 1), Array(32, 1), Array(40, 1), Array(41, 1), Array(47, 1), Array(88, 1),
Array(129, 1), _
Array(139, 1)), TrailingMinusNumbers:=True

So here is my question; I've used arrays lots of times in my own code, but
I'm not clear on the array statements in the fieldinfo section. They all end
in 1, so does the first number correspond to the width of the field? Is
there any conditions under which the second number would be something
_other_ than 1?

My real purpose of importing these files is so that I can load the entire
page into an array, and compare values to another file, and append new
information where appropriate. Is there a better way, for example, a way to
just read an entire text file into a large array (or array of arrays)?

Also, since I will be working with many files, I see the "origin" in this
case is 437. Any idea what specifically this refers to, or can I omit this
arguement and still have it work? The files will have been created (most
likely) on a VAX machine and FTP'd to a network location for our use.

Thanks for the assistance and clarification,
Keith

--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.