使用自定义分隔符Excel保存文件

我想知道是否可以用Excel来保存一个带有分隔符的文件,我可以select?

谢谢

是的,这是可能的。 转到Windows控制面板中的“区域和语言”设置。 点击“格式”选项卡上的“其他设置”。 将列表分隔符更改为您自己的自定义分隔符。

可能会给一些帮助:

Sub changeCharacter() Dim myFile As String Dim text As String Dim textline As String myFile = Application.GetOpenFilename() 'open your TXT/CSV file Open myFile For Input As #1 'open just for input Do Until EOF(1) Line Input #1, textline textline = Replace(textline, ",", "#") text = text & Chr(10) & textline Loop '#####################################3 'EOF = End Of File ' and this function sends true when reach the last ' line of the file... ' 'Line Input #1, textline ' take the next line in the TXT/CSV file an store it inside ' "textline" to replace the character "," for "#" using: 'textline = Replace(textline, ",", "#") ' and store the result again inside "textline" ' and finally, store the result into "text" to use it later '#####################################3 Close #1 'close the TXT/CSV fiel Open myFile For Output As #1 'open the same file againg, 'now to store the resulting data 'inside the file Write #1, text 'write the data into the file Close #1 'close it againg, now with the changes... End Sub 

这不是用不同的分隔符保存文件,但可以帮助改变它。