Translate

2013年6月20日 星期四

[VBA] Replace EOL characters for converting it from unix to window format

https://github.com/walter426/VbaUtilities/blob/master/FileSysUtilities.bas

Because the default txt editor(notepad, VBA I/O) cannot recognize the EOL defined in Unix.
It is necessary to do the conversion in window by replacing below three characters.
vbCrLf->vbCr;
vbCr->vbLf;
vbCrL-> vbCr.

Below is an example to make use of the function I written before to do the EOL conversion in a file.

Code:
 Call ReplaceStrInFile("./sample.txt", Array(vbCrLf, vbLf, vbCr), Array(vbCr, vbCr, vbCrLf))

Ref:
http://waltertech426.blogspot.hk/2013/06/vba-replace-multiple-strings-in-file.html

沒有留言:

張貼留言