保存为.vbs- Dim EXCEL, ExStr, FSO
- Set EXCEL = CreateObject("Excel.Application")
- EXCEL.Workbooks.Open CreateObject("Wscript.Shell").CurrentDirectory & "\a.xls"
- EXCEL.Visible = False
- i = 1:j = 1
- Do Until EXCEL.Cells(i, j).Value = vbNullString
- ExStr = ExStr & vbCrLf
- Do Until EXCEL.Cells(i, j).Value = vbNullString
- ExStr = ExStr & EXCEL.Cells(i, j).Value & vbTab
- j = j + 1
- Loop
- i = i + 1:j = 1
- Loop
- EXCEL.Workbooks.Close
- EXCEL.Quit
- Set EXCEL = Nothing
- Set FSO = CreateObject("Scripting.FileSystemObject")
- FSO.OpenTextFile("temp.txt", 2, True).Write ExStr
- CreateObject("Wscript.Shell").Run "Cmd /k Type temp.txt", 1, True
- FSO.DeleteFile "temp.txt"
- Set FSO = Nothing
复制代码
|