本帖最后由 apang 于 2014-12-19 23:32 编辑
- sPath = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName,"\"))
-
- Set objWord=CreateObject("Word.Application")
- objWord.Visible = True
- Set objDoc = objWord.Documents.Open(sPath & "1.DOC")
- row = objDoc.Tables(1).Rows.Count
- column = objDoc.Tables(1).Columns.Count
-
- Set objExcel = CreateObject("Excel.Application")
- objExcel.Visible = True
- objExcel.WorkBooks.Add
- objExcel.WorkSheets(1).Activate
-
- For i = 1 to row
- For j = 1 to column
- s = objDoc.Tables(1).Cell(i, j).Range.Text
- objExcel.ActiveSheet.Cells(i, j) = Left(s, Len(s)-1)
- Next
- Next
-
- objDoc.Close
- objWord.Quit
- objExcel.ActiveWorkBook.SaveAs sPath & "hello.xls"
- objExcel.WorkBooks.Close
- objExcel.Quit
复制代码
|