Search for a particular value in Excel
Set appExcel = CreateObject(“Excel.Application”)
appExcel.visible=true
Set objWorkBook = appExcel.Workbooks.Open (filepath)’opens the sheet
Set objSheet = appExcel.Sheets(“Sheet1″)’ To select particular sheet
With objSheet.UsedRange ‘ select the used range in particular sheet
Set c = .Find (“nn”)’ data to find
For each c in objSheet.UsedRange’ Loop through the used range
If c=”nn” then’ compare with the expected data
c.Interior.ColorIndex = 40′ make the gary color if it finds the data
End If
Set c = .FindNext(c)’ next search
next
End With
objWorkBook.save
objWorkBook.close
set appExcel=nothing
Author:Mohan Kakarla
6 Comments »
Leave a comment
-
Archives
- November 2008 (4)
- October 2008 (1)
- September 2008 (2)
- June 2008 (1)
- March 2008 (4)
- February 2008 (44)
-
Categories
- Automated Test Script Creation Process
- Automating MS Word
- Automating QC
- Automation Object Model For QTP
- Backward compatability in QTP
- Browser Scripts
- COM and QTP
- compare 2 text files
- Descriptive programming
- Descriptive Programming and Child Objetcs
- Dictonary Object
- DotNetFactory
- Excel Automation
- Extra Topics
- Files and Folders
- General Standards to be followed in Test scripts
- New Features In QTP9.5
- QC-OTA
- QTP Additional Faqs
- QTP Faqs
- QTP Naming Convention
- QTP Tips and Faqs
- Running stored procedures from QTP
- Send keyboard keys
- Uncategorized
- Uninstall a software using QTP
- Uninstall a software using vbscript
- Update data in a database
- VBScript and IE Automation
- VBScript Faqs and Useful resources
- What’s New in Quick Test Pro 9.0
- Whats New in QTP 9.5
- XML Scripting
-
RSS
Entries RSS
Comments RSS

hey can you help me in this issue ?
i have a batch process which runs for 8 hours .Now the developement of the application is complete .It’s in testing phase.while testing(automation testing , with any tool )can the script call the batch process in and can the script wait for results from batch process for such a long time ?
meyya,
yes it can wait , for that use shell object
Dim oShell
Set oShell = CreateObject (“WSCript.shell”)
oShell.run “cmd /K CD C:\Documents and Settings\kmohankumar\Desktop & 2.vbs”,,true’ here true indicates wait until this step completes, if u provide false here the qtp does not wait till it completes
Set oShell = Nothing
msgbox “hi”
Hi,
Can you please help me with a problem that I’m having with QTP? I need to loop through an excel sheet with data and create an array with required data.
I hope you can understand my question. Please let me know if you cannot. I’ll try in a different way. Thanks.
Hi
Good one
it will be more fast if you use this
Set appExcel = CreateObject(“Excel.Application”)
appExcel.visible=true
Set objWorkBook = appExcel.Workbooks.Open (filepath)
Set objSheet = appExcel.Sheets(“Sheet1″)
set objValueFind = objectSheet.UsedRange.Find(“rajiv”)
If Not objValueFind Is Nothing Then
rem find the address
firstAddress = objValueFind.Address
rem make the gary color if it finds the data
objValueFind.Interior.ColorIndex = 40
Do
Set objValueFind = .FindNext(objValueFind)
Loop While Not objValueFind Is Nothing And objValueFind.Address firstAddress
End If
Hi,
Can u please help me with this. I need to find the repeated entries also. The above code searches for a text but it colors only one again and again when multiple entries of the text are present.
Hello,
I’m a new in QTP. please help me, I wants write a test case in google web page, how to I write it or what is the procedure……….
Please help me………..