The xls contain data. how to get number of columns form
the sheet?

Answer Posted / uday

strFilePath="D:\EmpDetails.xls"
Dim fileSysObj
Set xlObj=createobject("Excel.application")
Set xlWorkBookObj=xlObj.workbooks.open(strFilePath)
Set xlWorkSheetObj=xlWorkBookObj.worksheets(1)

intRowCount=xlWorkSheetObj.UsedRange.rows.count 'intRowCount
=xlWorkSheetObj.rows.count - it returns the number of rown
in an Excel sheet

intColCount=xlWorkSheetObj.UsedRange.columns.count
' intColCount=xlWorkSheetObj.columns.count - it returns the
number of columns in an Excel sheet

msgbox "No. of rows used "&intRowCount&" and No. of columns
used. "&intColCount

xlWorkBookObj.close
xlObj.application.quit

Set xlObj=nothing
Set xlWorkBookObj=nothing
Set xlWorkSheetObj=nothing

http://hpsqtp.blogspot.com/2009/04/how-to-find-number-of-
rows-and-columns.html

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of parameters are there?

537


How to use actions in qtp ?

582


How to capture dynamic values in load runner and how Each of the captured values are to be written to a text file (c:\temp\LoadRunner1.txt)

1727


What is checkpoint in qtp?

544


Where we can use the synchronization?

567






What are test settings and global settings?

575


How to use the object spy in quicktest professional (qtp) 8.0 version?

503


Where you are storing your script?

627


how can i sent QTP results to the Html, notefile ,xl file give me the code using g mail login page

1822


How can get count of list box?

630


Hi there, I've installed a trial version of QTP to see if it works with my product but I cant automate selecting windows from a tree view? Can anyone give me any pointers? Many Thanks

1412


Explain advantages and disadvantages of ddf?

594


What is the XML file architecture ?

1541


In qtp, how you can remove the spaces from string?

538


What is a checkpoint? How many check points are there in qtp?

519