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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / ur

To get the column count use.
allCols = DataTable.GlobalSheet.GetParameterCount
Msgbox allCols

Is This Answer Correct ?    5 Yes 2 No

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

Answer / basha

for outside xls sheet we have follow below
datatable.addsheet("Sheetname")
datatable.importsheet("sheetname",sheetid,"sheetpath")
rowcount=datatable.getsheet("sheetname").getrowcount
msgbox(rowcount)

for globalsheet
rowcount=datatabe("GlobalSheet").getrowcount
msgbox (rowcount)

for actionsheet

rowcount=datatable("LocalSheet").getrowcount
msgbox (rowcount)

Is This Answer Correct ?    2 Yes 4 No

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

Answer / basha

for global sheet

rowcount=datatable.globalsheet.getrowcount
msgbox (rowcount)


for action sheet

rowcount=datatable.localsheet.getrowcount
msgbox (rowcount)

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More QTP Interview Questions

How to save your test using quicktest professional (qtp)?

0 Answers  


hi i have one isuue on selecting webcheckbox .there are 15 wecheckboxex i want to select every time 9 th one how can i select plese help me regards balaji

4 Answers  


According to use, how virtual object is different from object spy? If Qtp is not learning a sub-menues. What should we done? how would we manage on the expert view too? alkaa.dugaal@gmail.com

1 Answers   HCL,


Please clarify Automation and QTP both(names) are same or diff?

1 Answers  


What is an Regular expression doing in VBScript?Tell the pattern for the email verification.

0 Answers   Accenture,






What is exact difference between “while” and “do while” in QTP ?

1 Answers  


Read excel using qtp descriptive programing

2 Answers   TCS,


When ‘option explicit’ keyword is used in qtp?

0 Answers  


How do I get the QTP scripts result in xml format by using vb script function?

0 Answers  


Out of 3 recording modes. 1.Standard 2.Analog 3.Low-level, which one is commonly used. As per my knowledge, Analog is used for Graphs , barcoding or DIgital signatures.

0 Answers  


Pls let me know completely about descriptive programming, where it is used, pls explain with a real time example of its occurence and the program code written in qtp.

3 Answers  


in login module login button chage regularly(means login button change to submit button).What is the code for it.

3 Answers  


Categories