How to Import data from a ".xls" file to Data table during
Runtime.

Answer Posted / masack

If you want import all the sheets of the workbook during
runtime datatable.

Dim array_shtname()

Set xls = createobject("Excel.Application")
xls.visible = true
Set xlsop = xls.workbooks.open ("excel\path")
shtcount = xlsop.worksheets.count

ReDim preserve array_shtname(shtcount)

For sh = 1 to shtcount
array_shtname(sh-1) = xlsop.worksheets(sh).name
Next
xls.quit

Data_Sheet_Count = datatable.GetSheetCount

For i = 1 to shtcount
Datatable.AddSheet Cstr(array_shtname(i -1))
datatable.ImportSheet "excel\path",i,cint(Data_Sheet_Count)
+i
Next

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between shared and local object repository?

613


What are the types of object repositories? Which one is you are using?

626


Hi any body pls help me for QTP 11.0 software free demo version. i have to practice. Kindly send the link.or where i have to download.

1693


how to know no.of mails in our g mail by using vb-script

1774


Explain how you can delete excel file in qtp?

582






What is file database?

1686


distinguish between old version and new version QTP features.

1855


In QTP can we feed the out of one browser(internet explorer) as an input to the another browser(mozilla firefox)? If yes explain how to do it with an example.

1521


what type of framework u r using in ur organization

1640


What is action? How many types of actions are there in qtp?

609


How do I lauch my test website using code from qtp in different environmet, uat and PPTE?

1455


how did u use automating testing tools in ur job?

1479


What are the different attribute used with regular expression?

527


Why do we use "Text checkpoint" If we can make use of it in "standard checkpoint" ?

1476


What is synchronization point in QTP?

670