[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. Dim filespec : filespec = WScript.Arguments(0)
  2. 'CSV格式
  3. Const xlCSV = 6
  4. '当前版本EXCEL默认格式
  5. Const xlWorkbookDefault = 51
  6. '普通
  7. Const xlWorkbookNormal = -4143
  8. RecognizedFormatConvert filespec, xlCSV
  9. RecognizedFormatConvert filespec, xlWorkbookDefault
  10. RecognizedFormatConvert filespec, xlWorkbookNormal
  11. Sub RecognizedFormatConvert(sAnyFile, lXLFormat)
  12. Dim excel, fso, f, fname
  13. Set excel = CreateObject("Excel.Application")
  14. excel.Visible = False
  15. excel.DisplayAlerts = False
  16. Set fso = CreateObject("Scripting.FileSystemObject")
  17. Set f = fso.GetFile(sAnyFile)
  18. fName = Left(f.Name, InStrRev(f.Name, ".") - 1)
  19. excel.Workbooks.Open f.Path, 0, True
  20. excel.Workbooks(1).SaveAs fso.BuildPath(f.ParentFolder.Path, fName & "_New"), lXLFormat
  21. excel.Workbooks.Close
  22. excel.Quit
  23. End Sub
复制代码

TOP

返回列表