简体   繁体   English

Excel宏-将工作表导出到Windows逗号分隔的CSV

[英]Excel Macro - Export sheets to windows comma separated CSV

I've got this working, except I need the resulting files to be specifically a 'windows comma separated CSV' file. 我已经完成了这项工作,除了我需要将生成的文件专门设置为“ Windows逗号分隔的CSV”文件。 Any ideas how to specify this? 任何想法如何指定此?

Sub asdf()
    Dim ws As Worksheet, newWb As Workbook

    Application.ScreenUpdating = False
    For Each ws In Sheets(Array("sheet1", "sheet2"))
       ws.Copy
       Set newWb = ActiveWorkbook
       With newWb
          .SaveAs ws.Name & ".csv", xlCSV
          .Close (False)
       End With
    Next ws
    Application.ScreenUpdating = True
End Sub

它应该像将FileFormat指定为FileFormat一样CSVWindows

.SaveAs ws.Name & ".csv", xlCSVWindows

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM