Fwd: Get Cell Content from Excel using Column Name

2,545 views
Skip to first unread message

omkar

unread,
May 22, 2012, 3:49:12 AM5/22/12
to mercu...@googlegroups.com
Hi All,

I am working with Excel Object in QTP.

I want to get the Excel cell content using Column Name, Row Name.

Is there a way to do that.

OBJEXCELWORKSHEET.cell(RowName, ColumnName)

In RowName and ColumnName I want to provide the names instead of numbers.

--
Thanks & Regards,
Omkar Deekonda

iRahulSingh

unread,
May 22, 2012, 1:33:59 PM5/22/12
to QTP - HP Quick Test Professional - Automated Software Testing
Hi Omkar,

I can;t recollect any in-built function through which you can excel
cell value using rowname and columnname though it can be accessed
directly using objTable.getcelldata(rownum, columnnum ).

so what you can do is you can create a custom function which can find
out the rowname and columnname from excel pertaining to specific row
and column and then can use the implicit function to achieve what you
want.

do let us know if i'm not able to make my point clear.

Cheers..

sujit kumar

unread,
May 22, 2012, 2:18:31 PM5/22/12
to mercu...@googlegroups.com
Hi Omkar,

Set objExcel = CreateObject("Excel.Application")
Set objWorkBook = objExcel.Workbooks.Open ("C:\temp\Salary.xls") 
Set objSheet = objExcel.Sheets("Sheet1")
Set Cells=objSheet.Cells
   'Find Cell Position of "Column_Name
Set objvalueFind=objSheet.UsedRange.Find("Column_Name") 
If Not objvalueFind is Nothing  Then
sAddress=objvalueFind.Address
aRowCol=Split(sAddress,"$",-1,1)
End If
'In this way you can get name/position of Column and "aRowCol" Variable contain number of column
Same think you can do for to get Row number then combine both and enjoy :)

Feel free to ask if you have any query :)
--  
Thanks  & Regards 
Sujit :) 


--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en


Keshav Ramteerth

unread,
Jun 20, 2012, 9:01:41 AM6/20/12
to mercu...@googlegroups.com
Some tell me where i can get the Qtp 9.2
Reply all
Reply to author
Forward
0 new messages