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 you mean by artifact,milestone...

1503


How to test the login page in different ways in automation testing and i need code?

1352


wht type of User defined functions or Java Releated functions Do we write in VB scripting

1382


Call to copy of an action and call to existing action… i know the diff but in real project how to use..? i want live scenario.pls help me..

1283


Give me At Least 5 Differences between DOCUMENTATION OBJECT MODEL(DOM)and COMPONENT OBJECT MODEL(COM)? Interviewer said me to WRITE the difference only in points not as you WRITE a paragraph ???? only in points

1633






How to use reporter.report event in qtp ?

562


What is ‘object spy’ and what is the function of object spy in qtp?

578


hi guys, pls tell me for testing institution training hub, hitech city is best or not?

1325


Explain about the test fusion report of quicktest professional?

535


When QTP object wait time is 10 seconds, and in test script wait time is 5 seconds and in function library wait time is 2 seconds how much time does the wait occur? or which is given priority.

1633


What is the process of synchronizing qtp and aut?

574


your coming from electrical backgroung..but y ur coming to software side?

1393


How qtp identifies objects?

573


I want to do Certification course in QTP. For this I request you to suggest the best Tutorial in PDF format. Hence, if possible, kinldy mail PDF file to my mail-ID: sushmapokhriyal79@gmail.com

1500


How to handle the exceptions using the recovery scenario manager in qtp?

573