VBS script required to remove " from .ttx file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grego9
    New Member
    • Feb 2007
    • 63

    VBS script required to remove " from .ttx file

    I have a file that is stored in C:\users\123456 \ with the name export.ttx . I want to create a VBS script that opens up this file, removes all the " in the file (and replaces these " with nothing)and then saves down the amended file as a .csv file. I am not sure where to start. To be clear I want the rest of the file contents to be unchanged - I only want to remove the "'s. Can anyone offer any help?
    thanks
  • Luk3r
    Contributor
    • Jan 2014
    • 300

    #2
    Edit**: I felt bad for giving you direction toward VB.NET so I'm including code for a vbscript that will literally do exactly what you want. Let me know how it goes:

    Code:
    Const ToRead = 1
    Const ToWrite = 2
    
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set File = FSO.OpenTextFile("c:\directory\export.txt", ToRead)
    
    readText = File.ReadAll
    File.Close
    readText = Replace(readText, """", "")
    Set File = FSO.OpenTextFile("c:\directory\export.txt", ToWrite)
    File.WriteLine readText
    File.Close
    
    FSO.MoveFile "c:\directory\export.txt", "c:\directory\export.csv"

    Comment

    • grego9
      New Member
      • Feb 2007
      • 63

      #3
      I am a bit of a novice with VBS so I'm not sure what the difference is betweem VBS and VB.net!

      Comment

      • grego9
        New Member
        • Feb 2007
        • 63

        #4
        Works perfectly! Thank-you so much, that will save me a lot of time!

        Comment

        Working...