Hi All,
I have a problem to solve.I am importing 200000 records(.txt) in notepad into excel but when it gets to 65000 records it truncates telling me that not completely exported.I now write a code in vb editor(excel) trying to count every 5records and export to excel.Please, have a look at this code and correct.Thanks.
rgds
jimi
Public NumberOfRecords As Integer
Dim data(i, 2) As String
Dim g, fileName As String
Dim i, numlines, lines, As Integer
Dim line_Name(i), short_Point(i), x(i), y(i), s(i) As Double
Private Sub OpenFileBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenFileBtn.Click
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then 'opens file of users choice if cancel not pressed
FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
lines = getNumLines(1)
FileClose (1)
FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
ReDim data(lines, 2)
For i = 0 To i = lines - 1
Input(1, data(i, 0))
Input(1, data(i, 1))
Input(1, data(i, 2))
line_Name(i) = Val(data(i, 0))
short_Point(i) = Val(data(i, 1))
x(i) = Val(data(i, 2))
y(i) = Val(data(i, 3))
s(i) = Val(data(i, 4))
Next i
FileClose (1)
End If
End Sub
Public Function getNumLines(ByVal fileName As Integer) As Integer
Dim numlines As Integer
numlines = 0
While Not (EOF(1))
numlines = numlines + 5 'counts number of rows in the file
Input(5, g)
End While
Return numLines 'return the number of lines found
End Function
End Class