在 VBS 中用分号而不是逗号保存 .csv 文件

Save a .csv file with a semicolon instead of a comma in VBS

我需要通过 vbs 文件将 excel 文件列表转换为分号 csv 文件,因为我使用的程序只导入以分号作为分隔符的 vbs 文件,我在 vbs 中编写了这个小文件,但是它设法用逗号而不是分号将其导出为 csv。

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Users\loren\Desktop\eFolder" 'folder where my Excel files are saved

Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
    csv_format = 6
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    src_file = objStartFolder & "\" & objFile.Name 'Input files
    dest_file = objStartFolder & "\OUTPUT\" & objFile.Name & ".csv" 'Output files
    
    Dim oExcel
    Set oExcel = CreateObject("Excel.Application")
    
    Dim oBook
    Set oBook = oExcel.Workbooks.Open(src_file)
    
    oBook.SaveAs dest_file, csv_format
    
    oBook.Close False
    oExcel.Quit
Next

我通过将 Local argument 的参数设置为 True 来保存文件来解决它。感谢@VBasic2008

的回复
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Users\loren\Desktop\eFolder"

Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
    csv_format = 6
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    src_file = objStartFolder & "\" & objFile.Name
    dest_file = objStartFolder & "\OUTPUT\" & objFile.Name & ".csv"
    
    Dim oExcel
    Set oExcel = CreateObject("Excel.Application")
    
    Dim oBook
    Set oBook = oExcel.Workbooks.Open(src_file)
    
    oBook.SaveAs dest_file, csv_format, , , , , , , , , , True
    
    oBook.Close False
    oExcel.Quit
    
Next