I am trying to edit a text file using Microsoft access vba. What I want to do is the remove all the comma from the text file.
I tried the some of the codes online and it works perfectly fine for my test file.
What the code is to replace the “,” in the file with “”
However, when I try to run it on my actual text file, the access will become not responding , I waited 2 hours , but still didn’t responded.
I not sure is it because of my data is too huge, the size of my text file is 417MB.
Is there anyone is able to advise me on this? Thank you!
The code i am using
Private Sub Click()
Dim sBuf As String
Dim sTemp As String
Dim iFileNum As Integer
Dim sFileName As String
sFileName = "C:123\123\data.txt"
iFileNum = FreeFile
Open sFileName For Input As iFileNum
Do Until EOF(iFileNum)
Line Input #iFileNum, sBuf
sTemp = sTemp & sBuf & vbCrLf
Loop
Close iFileNum
sTemp = Replace(sTemp, ",", "")
iFileNum = FreeFile
Open sFileName For Output As iFileNum
Print #iFileNum, sTemp
Close iFileNum
End Sub