本帖最后由 flashercs 于 2022-8-6 21:31 编辑
- Set excel=CreateObject("Excel.Application")
- Set book=excel.Workbooks.Open("d:\test\a.xlsx")
- Set sheet=book.Worksheets(1)
- Set orange=sheet.UsedRange
- Set fso=CreateObject("Scripting.Filesystemobject")
- Set ts=fso.OpenTextFile("a.txt",2,True)
- For Each cell In orange.Columns(1).Cells
- value=cell.Value()
- If Instr(1,value,"solder")>0 Then
- ts.WriteLine value
- End If
- Next
- For Each cell In orange.Rows(2).Cells
- value=cell.Value()
- If Instr(1,value,"solder")>0 Then
- ts.WriteLine value
- End If
- Next
- ts.Close
- excel.Workbooks.Close
- excel.Quit
复制代码
|