- 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
- For i=1 To rows
- For j=1 To columns
- Set cell = objSheet.Cells(i, j)
- If Trim(cell.value) = "data" Then
- s = s & cell.address & " 列:" & j & " 行:" & i & vbCrLf
- End If
- Next
- Next
- WSH.echo s
- objBook.Close
- objExcel.Quit
复制代码
|