vba 如何使用 Split 使用换行符作为分隔符来标记文本文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8669788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use Split to tokenize text file using the new line character as a delimiter
提问by
Using VBA how would one go about using the VBA.Split method to tokenize text file using the new line character as a delimiter?
使用 VBA 如何使用 VBA.Split 方法使用换行符作为分隔符来标记文本文件?
The following don't seem to work:
以下似乎不起作用:
Split(myText, "\n")
Split(myText, vbCrLf)
Split(myText, vbNewLine)
回答by
After a little investigation turns out the answer is:
经过一番调查,答案是:
Split(data, vbLf)
回答by aevanko
If you are working within VBA
, you don't need all the VBA
tags:
如果您在 内工作VBA
,则不需要所有VBA
标签:
Split(data, vbLf)
回答by Karthick Gunasekaran
Another way to get it work is
让它工作的另一种方法是
split(myText,Chr(13) + Chr(10))