Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default How to detect excess rows in txt or csv files before opening?

Windows XP Pro SP2
Excel 2002 SP3

I am trying to detect if a txt or csv file has more than 65,536 lines before
opening it. I've written this little tidbit for testing:

Sub testme()

Dim data As String
Dim fname As String
Dim c As Long

fname = "C:\911\_temp\test_data1.csv"

Open fname For Input As #1
c = 0
Do Until EOF(1)
Line Input #1, data
c = c + 1
Loop
Close #1

MsgBox c

End Sub


This works fine on files with less than or equal to 65,536 lines of data.
If I try the same code on a file with 65,537 lines or more then Excel locks
up.

Is there any way around this? Why is Excel crashing? Should I bite the
bullet and learn to use Access?

Any and all suggestions welcome. Thanks!

-gk-


================================================== ======================
"The creative act is not the province of remote oracles or rarefied
geniuses but a transparent process that is open to everyone."
-Greg Kot in Wilco Learning How To Die-



Reply
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
Office button, how to remove excess files no longer needed Jim[_9_] Excel Discussion (Misc queries) 2 February 13th 09 02:57 PM
Additional rows added to spreadsheet when opening text files kidofseph Excel Discussion (Misc queries) 0 April 25th 07 09:54 PM
How to detect excess rows in txt or csv files before opening? 39N 95W Excel Programming 3 December 21st 05 08:19 PM
How to detect and view more than 65,536 rows when opening a DBF 42N83W Excel Programming 1 December 11th 05 01:39 PM
opening text files that have more rows than 65536 rondajoy Excel Worksheet Functions 3 June 8th 05 03:41 PM


All times are GMT +1. The time now is 05:39 AM.

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

About Us

"It's about Microsoft Excel"