- Dim objExcel
- Set objExcel=CreateObject("Excel.Application")
- objExcel.DisplayAlerts=false
- objExcel.visible=true
- search="22"
- subtitution="A"
- col=1
- row=1
- Set objWorkBook=objExcel.WorkBooks.Open("C:\Users\yiy\Downloads\Dos\1\Test.xlsx")
- do until objExcel.Workbooks(1).WorkSheets(1).Cells(row,col).value=""
- do until objExcel.Workbooks(1).WorkSheets(1).Cells(row,col).value=""
- if objExcel.Workbooks(1).WorkSheets(1).Cells(row,col).value=search then
- objExcel.Workbooks(1).WorkSheets(1).Cells(row,col).value=subtitution
- objExcel.Workbooks(1).WorkSheets(2).Cells(row,col).value=subtitution
- end if
- row=row+1
- loop
- col=col+1
- row=1
- loop
- objWorkBook.Save
- objWorkBook.Close
- objExcel.Quit
复制代码
|