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

WHAT IS ENVIRONMENT VARIABLES?

7 Answers   AZTEC, CTS, Ready Test Go,


Can any one please explain hwo to test client/server application using QTP?

3 Answers   Patni, Value Labs,


can anyone answer this question ........in the DICTIONARY OBJECT....i created the dictionary object in reserved object ok....here i have some sets of values ...now i want to retrieve the item i done too ok.......here my question is now i saved the test and close the qtp tool ,again i opened now i retrieve the same item in the dictionary is it possible ????. friends when i try to do this i am getting empty message box i mean no value will be retrieved ......ans me any one plz...

1 Answers   FSS,


How to Open FireFox using descriptive programing? If my question is not clear, i will give an Example To Open Internet Explorer, We use Set IE = CreateObject(InternetExplorer.Application) IE.Navigate "www.yahoo.com In the same i need to open yahoo.com in firefox. Can any one tell me what is the server name of firefox to create an object

0 Answers  


I would like to directly import XL file and work on that XL file directly in QTp script in that XL sheet need to allocate workbench,XL sheet and generate two bar graphs automatically how to do that? plz let me know any answers?

0 Answers   Wipro,






How QTP integrate with application?

1 Answers  


How do we retrieve the content from a text box in a web page

2 Answers  


UFT 12.02 which ALM version will support

0 Answers  


What is Descriptive Programing? In which cases, we will go for descriptive programing?

2 Answers   CTS,


anyone can explain about "Smart Identification" in QTP I mean what is the use of "Smart Identification" Give an example

2 Answers  


What are parameterizing tests?

0 Answers  


How to create frame work for qtp?

1 Answers   Bank Of America, Polaris,


Categories