- Dim filespec : filespec = WScript.Arguments(0)
-
- 'CSV格式
- Const xlCSV = 6
- '当前版本EXCEL默认格式
- Const xlWorkbookDefault = 51
- '普通
- Const xlWorkbookNormal = -4143
-
- RecognizedFormatConvert filespec, xlCSV
- RecognizedFormatConvert filespec, xlWorkbookDefault
- RecognizedFormatConvert filespec, xlWorkbookNormal
-
- Sub RecognizedFormatConvert(sAnyFile, lXLFormat)
- Dim excel, fso, f, fname
- Set excel = CreateObject("Excel.Application")
- excel.Visible = False
- excel.DisplayAlerts = False
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set f = fso.GetFile(sAnyFile)
- fName = Left(f.Name, InStrRev(f.Name, ".") - 1)
- excel.Workbooks.Open f.Path, 0, True
- excel.Workbooks(1).SaveAs fso.BuildPath(f.ParentFolder.Path, fName & "_New"), lXLFormat
- excel.Workbooks.Close
- excel.Quit
- End Sub
复制代码
|