本帖最后由 zjw767676 于 2015-3-28 09:52 编辑
下面的代码是将文件拖动到Vbs中,请教如何指定文件名转换?
fienname= 文件的绝对路径 (相对路径不行) | | | Filename = WScript.Arguments(0) | | Set ExcelApp = CreateObject("Excel.Application") | | Set ExcelOut = ExcelApp.Workbooks.Open(Filename) | | If LCase(Right(Filename,4))=".xls" Then | | RowC = ExcelOut.WorkSheets(1).UsedRange.Rows.Count | | For i = 2 to ExcelOut.WorkSheets.Count | | ExcelOut.WorkSheets(i).UsedRange.Copy | | ExcelOut.WorkSheets(1).Range("A" & RowC + 1).PasteSpecial | | RowC = RowC + ExcelOut.WorkSheets(i).UsedRange.Rows.Count | | Next | | ExcelOut.WorkSheets(1).SaveAs Left(Filename,instrrev(Filename,".")) & "TXT",3 | | End If | | ExcelOut.Saved = True | | ExcelOut.Close | | Wscript.QuitCOPY |
|