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: 2
Default Error in large file import macro

I am trying to use the macro that many people linked to here for importing
data longer than the 65536 rows permited in excel. Wen I run it, it loads
in the first line ok then errors out. It gives me a "Input past end of
file" error at Line Input #FileNum, ResultStr<. The full macro is as
follows:

Sub LargeFileImport()

Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
FileName = InputBox("Please enter the Text File's name, e.g.
test.txt")
If FileName = "" Then End
FileNum = FreeFile()
Open FileName For Input As #FileNum
Application.ScreenUpdating = False
Workbooks.Add template:=xlWorksheet
Counter = 1
Do While Seek(FileNum) <= LOF(FileNum)
Application.StatusBar = "Importing Row " & _
Counter & " of text file " & FileName
Line Input #FileNum, ResultStr
If Left(ResultStr, 1) = "=" Then
ActiveCell.Value = "'" & ResultStr
Else
ActiveCell.Value = ResultStr
End If

If ActiveCell.Row = 65536 Then
ActiveWorkbook.Sheets.Add
Else
ActiveCell.Offset(1, 0).Select
End If
Counter = Counter + 1
Loop
Close
Application.StatusBar = False

End Sub


Due to I am loading in data that 1s 16 columns by 200000+ rows I would like
to get this working.

--
Message posted via http://www.officekb.com
 
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
macro-import another xls file puiuluipui Excel Discussion (Misc queries) 9 April 1st 10 06:48 PM
macro to import file (help with a piece of code) uriel78 Excel Programming 4 March 12th 05 08:36 AM
vb.net import macro error and allow visual basic is checked in se. villains32 Excel Programming 0 January 13th 05 02:35 PM
Recording a macro to open a large fixed-width text file Lucie Harris Excel Programming 3 September 1st 04 02:23 AM
macro which import alfa*.txt file, how to ? ss_era Excel Programming 1 August 24th 04 01:47 PM


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