VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Comma De-Limited

by Howard Lee (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

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

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

Rate Comma De-Limited

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

Download this snippet    Add to My Saved Code

Comma De-Limited Comments

No comments have been posted about Comma De-Limited. Why not be the first to post a comment about Comma De-Limited.

Post your comment

Subject:
Message:
0/1000 characters