Tools Links Login

Comma De-Limited

This code will read a file line by line and create a comma delimited text file which can then be imported into Excel.

Original Author: Howard Lee

Inputs

FileRead = File To be read as input
FileOutPut = file that will be created as output

Code

Private Sub Form_Load ()
Dim instring As String
Dim outstring As String
On Error GoTo Clnup
Open "FileRead.txt" For Input As #1 ' file opened for reading
Open "FileOutPut.txt" For Output As #2 ' file created

Line Input #1, instring
While Not EOF(1)
  Line Input #1, instring
  If Len(outstring) = 0 Then
    outstring = instring
  Else
    outstring = outstring & "," & instring
  End If
  
Wend
Print #2, outstring
Close #1
Close #2
Clnup:
Close
End
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 89 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.