我有一个咕嘟咕嘟任务手表Excel文件并运行的VBScript:转换Excel文件CSV - 不能剿Excel的提示窗口
咕嘟咕嘟代码:
.pipe(shell([
'XlsToCsv.vbs test test.xlsx test.csv'
]))
VBScript代码:
If WScript.Arguments.Count < 3 Then
WScript.Echo "Please specify the sheet, the source, the destination files. Usage: ExcelToCsv <sheetName> <xls/xlsx source file> <csv destination file>"
Wscript.Quit
End If
csv_format = 6
Set objFSO = CreateObject("Scripting.FileSystemObject")
src_file = objFSO.GetAbsolutePathName(Wscript.Arguments.Item(1))
dest_file = objFSO.GetAbsolutePathName(WScript.Arguments.Item(2))
Dim oExcel
Set oExcel = CreateObject("Excel.Application")
Dim oBook
Set oBook = oExcel.Workbooks.Open(src_file)
oBook.Sheets(WScript.Arguments.Item(0)).Select
oBook.SaveAs dest_file, csv_format
oBook.Close False
oExcel.Quit
除了当我以CSV格式重新保存文件时的提示跳转,它工作正常。 就像“有这个名字的文件已经存在,你想保存它吗?”
节省,因为咕嘟咕嘟观察者将触发执行代码之前,我不能删除一个文件。 oBook.Close SaveChanges = True
和oExcel.DisplayAlerts = False
没有工作。
我需要在每次保存时静静地运行此脚本。
我应该在脚本中添加什么命令?
P.S.我不介意使用任何其他脚本,除了PowerShell的 - Set-ExecutionPolicy remotesigned
导致错误
的Set-ExecutionPolicy:访问被拒绝的注册表项HKEY_LOCAL_MACHINE \ Microsoft.PowerShell”
回复:PowerShell的 - 你需要从提升的提示 –