本帖最后由 pcl_test 于 2017-4-8 13:19 编辑
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set objExcel= CreateObject("Excel.Application")
- file = fso.GetFolder(".").Path & "\测试.xls"
- Set objBook = objExcel.Workbooks.Open(file)
- objBook.WorkSheets(1).activate
- Set objSheet = objBook.activeSheet
- rows = objSheet.UsedRange.Rows.count
- columns = objSheet.UsedRange.Columns.Count
- Dim arr()
- For i=1 To rows
- For j=0 To columns-2
- ReDim Preserve arr(j)
- arr(j)=objSheet.Cells(i, j+2)
- Next
- line = Join(arr, " ")
- 'fso.CreateTextFile(objSheet.Cells(i, 1) & ".txt", 2).Write(line)
- s = s & line & " --> " & objSheet.Cells(i, 1) & ".txt" & vbCrLf
- Erase arr
- Next
- WSH.echo s
- objBook.Close
- objExcel.Quit
复制代码
|