From: Codeblack on 1 Feb 2009 01:06 Const ForReading = 1 strSearchTerm = "Vasuki" strPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "test.xls" boolMatchCase = False Set objExcel = CreateObject("Excel.Application") objExcel.Visible = false objExcel.DisplayAlerts = FALSE objExcel.ScreenUpdating = False Const xlFormulas = -4123 Const xlPart = 2 Const xlByRows = 1 Const xlNext = 1 Set objWorkbook = objExcel.Workbooks.Open(strPath, False, True) For Each objWorkSheet In objWorkBook.Sheets intFoundRow = -1 objWorkSheet.Activate Set objCell = objWorkSheet.Cells.Find(strSearchTerm, objWorkSheet.Cells(1,"A"), xlFormulas, xlPart, xlByRows, xlNext, boolMatchCase) x = objCell.value If Not objCell Is Nothing Then If objCell.Row > intFoundRow Then For each item in objCell.value strResults = strResults&VbCrLf&objWorkSheet.Name&" Row:"&objCell.Row intFoundRow = objCell.Row Wscript.echo x Next Else Set objCell = Nothing End If End If Next objWorkBook.Close objExcel.ScreenUpdating = True objExcel.Quit '******************* Writing to output file ***************** If strResults <> "" Then MsgBox strSearchTerm & " was found on the following sheets:" & strResults Else MsgBox strSearchTerm & " was not found" End If
First
|
Prev
|
Pages: 1 2 3 4 Prev: Help desperately needed. Next: Connecting to Win32_DFSTarget on Windows Server 2008 |