Advertisement
Guest User

how to replace form feeds in a text file

a guest
Jun 21st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Const ForReading = 1
  2. Set objFSO = CreateObject("Scripting.FileSystemObject")
  3. Set objOpen = objFSO.OpenTextFile("c:\bad_text.txt", ForReading)
  4.  
  5. FileContent = objOpen.ReadAll
  6. arrFileName = Split(FileContent, vbCrLf)
  7.  
  8. outFile="c:\good_text.txt"
  9. Set objFile = objFSO.CreateTextFile(outFile, True)
  10. Const intFrom = 1
  11. Const intTo = -1
  12. Const binaryCompare = 0
  13. objFile.Write Replace(Join(arrFileName, vbCrLf), Chr(12), "", intFrom, intTo, binaryCompare)
  14.  
  15. objOpen.Close
  16. Set objOpen = Nothing
  17. Set objFSO = Nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement