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 are table and db checkpoints?

797


What is quick test pro?

824


What is checkpoints for quicktest professional (qtp)?

771


Which HTML specification will be adhered to? How strictly? What variations will be allowed for targeted browsers?

768


Explain about the quicktest professional (qtp) automation object model?

765


how to test load test and block box testing an a web based application pls give ans briefly

1583


Does quicktest professional (qtp) is unicode compatible?

751


Explain different types of action in qtp?

795


hi in real time who will execute the qtp test scripts? my faculty said, in a companty automation testers are written the test scripts and manual testers are execute the test scripts...IS IT RIGHT OR NOT?

3209


hi i have completed my b.tech in cse stream. now i am working in an organisation in testing department. i want do sap course but i dnt know which module will boost my career can anyone suggest me which is good for my career

2175


Explain the concept of object repository and how quicktest professional recognises objects?

766


HI, pls help me on this, iam not able to capture getcelldata value in javatable... msgbox javawindow("").javatable("").getcelldata(3,3) but it diaplays empty...

2608


How to use debug tools?

2424


Write the script to delete the mail which is at 9th,13th and 18th place in INBOX of Gmail ?

1886


I recorded a Web App with a Oracle backend using QTP 9.5 and for some reason the scripts don't play back> What am I missing at this point. I recorded the same Apps under Sybase and they work great. This is Oracle 10g. Why won't my scripts play back.

1754