Save as CSV with semicolon separator

后端 未结 6 1220
庸人自扰
庸人自扰 2021-01-17 17:06

I\'m currently use this function for saving, but I have a problem with it:

Private Sub spara()
    ActiveWorkbook.SaveAs Filename:=\"T:\\filepath+ ActiveWork         


        
6条回答
  •  有刺的猬
    2021-01-17 17:43

    For people having issues with this code

    dim wa as Workbook
    
    Workbooks.OpenText FileName:=path2file, _
    DataType:=xlDelimited, Semicolon:=True, Local:=True
    set wa = ActiveWorkbook
    
        wa.SaveAs FileName:=path2file, FileFormat:=xlCSV, _ ConflictResolution:=xlLocalSessionChanges, Local:=True
    
        wa.Close False
    

    The second line is really important, if wa.Close False is not there it will ask for approval to save, or if wa.Close True it will replace the ";" for ",".

    After going into local settings and making ";" the list delimiter, VBA was still separating with a ",". Modified the code to the above and it was done.

    Hope this throw some light for some

提交回复
热议问题