MrExcel Publishing
Your One Stop for Excel Tips & Solutions

opening a large file


Posted by Steve Vanderkolff on October 18, 1999 8:51 AM

I am attempting to open up a file greater than 66000 lines long. How do I go about this? It automatically cuts it off at the page length. Lotus will take it to the next page in the worksheet but Excel doesn't.


Posted by Chris on October 18, 1999 9:18 AM

It's not going to work. Excel will only go up to 65536. Anything beyond that will be automatically cut off. You will have to split it into multiple files within another app. Are you sure Excel is the proper tool for this job?

Chris

Posted by Ivan Moala on October 19, 1999 3:14 AM

Chris is correct limit there is a limit excel97
Here is a work around from Ms

Sub LargeFileImport()

'Dimension Variables
Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
'Ask User for File's Name
FileName = InputBox("Please enter the Text File's name")
'Check for no entry
If FileName = "" Then End
'Get Next Available File Handle Number
FileNum = FreeFile()
'Open Text File For Input
Open FileName For Input As #FileNum
'Turn Screen Updating Off
Application.ScreenUpdating = False
'Create A New WorkBook With One Worksheet In It
Workbooks.Add template:=xlWorksheet
'Set The Counter to 1
Counter = 1
'Loop Until the End Of File Is Reached
Do While Seek(FileNum) <= LOF(FileNum)
'Display Importing Row Number On Status Bar
Application.StatusBar = "Importing Row " & _
Counter & " of text file " & FileName
'Store One Line Of Text From File To Variable
Line Input #FileNum, ResultStr
'Store Variable Data Into Active Cell
If Left(ResultStr, 1) = "=" Then
ActiveCell.Value = "'" & ResultStr
Else
ActiveCell.Value = ResultStr
End If

'For xl97 and later change 16384 to 65536
If ActiveCell.Row = 16384 Then
'If On The Last Row Then Add A New Sheet
ActiveWorkbook.Sheets.Add
Else
'If Not The Last Row Then Go One Cell Down
ActiveCell.Offset(1, 0).Select
End If
'Increment the Counter By 1
Counter = Counter + 1
'Start Again At Top Of 'Do While' Statement
Loop
'Close The Open Text File
Close
'Remove Message From Status Bar
Application.StatusBar = False

End Sub


regards


Ivan

Posted by B on October 27, 1999 10:50 AM

I would suggest using Microsoft Access 97.