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

时间:2016-05-09 15:03:24

标签: excel

我想知道Excel是否可以使用我可以选择的分隔符保存文件?

谢谢

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

可能这可以提供一些帮助:

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

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