Open a csv file do Find and Replace then Save

  • I have a csv file that I want to open, find commas (,) and replace them with nothing (""), save and close.

    Posted this in the wrong forum.

    This is what I have so far:

    Public Sub Main()

    Dim fn As String

    Dim t As String

    fn = "\\SQL2\Import\AccellerDailyDownload_TEST.csv"

    t = System.IO.File.ReadAllText(fn)

    t = t.Replace(",", "")

    End Sub

    I changed a bit due to a previous comment. I run this, says it succeeded but I go and open the file and the commas are still there, what am I missing?

    Thanks!

  • You have to write the file back to disk. Add this:

    System.IO.File.WriteAllText(fn, t)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply