LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Strip records from large textfile with VBA

Dear members;

I'm stuck with the following chalange.
I must read some (not all) records from a textfile into a workbook.
But......

The Excel version is 2003 (can and may not be 2007) and the textfile
contains over 250.000 records !!
The fields from the textfile are seperated by semi-colons and I only need
those records where the 5th field exceeds 0.
The textfile is not fixed-width, so I can't fix this position in a record
(but it is the position I need to find).

What method should I use to extract those records using VBA.

Is it possible to alter this module ?

Private Sub Extract_Records()
Open ThisWorkbook.Path & Application.PathSeparator & "Invoice.txt" For
Input As #1
r = 1
Do While Not EOF(1)
Line Input #1, Data
'Do not import a record that begins with Total
If Not Left(Data, 5) = "TOTAL" Then '---- I think I should change
this line of code, but How ? It must find the 5th field 0
'Import record
r = r + 1
Cells(r, 1).Value = Data
End If
Loop
Close #1
End Sub

----
I hope that this is clear enough !!


--
Regards;
Mark Rosenkrantz
--
Spreadsheet Solutions
Uithoorn
Netherlands
--
E:
W:
www.spreadsheetsolutions.nl
--

 
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
Trying to NOT import some records in a large text file Francois via OfficeKB.com Excel Programming 8 September 30th 08 08:04 AM
XY Scatter-problems with large data records DataGeek Excel Discussion (Misc queries) 1 May 28th 08 09:53 PM
Manipulate textfile with VBA Romanoff Excel Programming 2 July 27th 07 05:34 AM
very large text and CONTINUE records [email protected] Excel Programming 0 April 19th 06 04:34 PM
Export as Textfile with VBA moondark[_11_] Excel Programming 2 December 14th 05 01:45 PM


All times are GMT +1. The time now is 12:22 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"