- Dim Path, FSO, EXCEL, Book, Arr, Str
- Path = CreateObject("Wscript.Shell").CurrentDirectory & "\"
- Set FSO = CreateObject("Scripting.FileSystemObject")
- Str = FSO.OpenTextFile(Path & "a.txt").ReadAll()
- Arr = Split(Str, vbCrLf)
- Set FSO = Nothing
- Set EXCEL = CreateObject("Excel.Application")
- EXCEL.Visible = False
- Set Book = EXCEL.Workbooks.Open(Path & "b.xls")
- i = -5
- For Each Str In Arr
- If Str <> "" Then
- i = i + 1
- If i > 0 Then EXCEL.Cells(i, 2).value = Split(Str, ";")(3)
- End If
- Next
- Book.Save
- Book.Close
- Set Book = Nothing
- EXCEL.Quit
- Set EXCEL = Nothing
- MsgBox "导入完成!", , "ArdentMan友情提示"
复制代码
|