User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 391,555 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,639 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 1663 | Replies: 0
Reply
Join Date: Feb 2007
Posts: 1
Reputation: Jimi.Owoseni is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Jimi.Owoseni Jimi.Owoseni is offline Offline
Newbie Poster

Help import textfile to excel

  #1  
Mar 3rd, 2007
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
Last edited by Comatose : Mar 9th, 2007 at 3:34 pm.
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 9:35 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC