LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Best way to import fixed-width delimited text files into an array?

You can use low level fileio:

http://www.applecore99.com/gen/gen029.asp


http://support.microsoft.com/support...eio/fileio.asp
File Access with Visual Basic® for Applications


Sub ReadStraightTextFile()
Dim LineofText As String
Dim rw as Long
rw = 0
Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1
Do While Not EOF(1)
Line Input #1, LineofText
rw = rw + 1
' now parse LineofText according to the column widths and
' put the values in an array.
Loop
'Close the file
Close #1
End Sub

--
Regards,
Tom Ogilvy

"KR" wrote in message
...
Should I use the Workbooks.OpenText Filename, or is there a faster way to
bring in the file?

Actually, I may not even need the file in a worksheet, I just need the

data
in an array so I can use it to manipulate an existing excel file...so

would
it be faster to do some alternate type of file read directly into a
2-dimensional array?

Thanks for any advise,
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.




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fixed Width Text Import Settings Bryan Excel Discussion (Misc queries) 4 July 8th 08 12:15 AM
Automate the Text Import Wizard (Fixed Width) Yagnesh Excel Worksheet Functions 5 August 25th 05 08:08 PM
How do I import/convert tab delimited text files into Excel? jim Excel Worksheet Functions 10 May 3rd 05 10:46 PM
Basic Q: Field/Array info when importing fixed-width text files KR Excel Programming 0 March 1st 05 09:02 PM
Automatically Parsing Fixed-width Text Import Bill[_29_] Excel Programming 3 October 5th 04 06:11 AM


All times are GMT +1. The time now is 02:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"