After try some code I found in the forum Im getting an error message that the file still open, therfore cannot be import...see code below...can anybody point to me what Im doing wrong?
<font class="small">Code:</font><hr /><pre>
sCompleteName = "MyPath\MyFile.xls"
Set xls = createobject("Excel.Application")
xls.visible = true
Set xlsop = xls.workbooks.open (sCompleteName)
shtcount = xlsop.worksheets.count
ReDim preserve array_shtname(shtcount)
For sh = 1 to shtcount
array_shtname(sh-1) = xlsop.worksheets(sh).name
Data_Sheet_Count = datatable.GetSheetCount
For i = 1 to shtcount
Datatable.AddSheet Cstr(array_shtname(i -1))
So as you can see I'm closing the excel before trying to import, never the less keeps telling me that is open by another application.
Using QTP11, Windows 7, Office 2010
Your above code should work,
try the following:
-1.restart your machine.
-2.use a small Excel file with the same above code.
let us know your results.
You may want to try making the excel file shared if it's not already.
Patience is like bread I say.... I ran out of that yesterday.
Add below before quite method
Buy the NEW QTP Descriptive Programming Unplugged Book
** Download QTP Unplugged 2nd Edition eBook for FREE **