Micro Focus QTP (UFT) Forums
Excelsheet data entry - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Excelsheet data entry (/Thread-Excelsheet-data-entry)



Excelsheet data entry - Anshu - 07-11-2017

How to use code of attaching excel sheet so that it can take input from excel of desirable row and column and can also be able to put data to excel during run time .
Right now i am using this code but not able to take input from 2nd,3rd row n so on.....
Public Function GetInputFromExcel(InputFilePath,sheetName,VariableName)


set objExcel = createobject("excel.application")
objExcel.DisplayAlerts=false
set objWB = objExcel.workbooks.open (InputFilePath)
set objsheet = objwb.worksheets(sheetName)

For j = 1 to objsheet.usedrange.columns.count
If Ucase(objsheet.Cells(1,j).value) = Ucase(VariableName) Then
GetInputFromExcel = objsheet.Cells(2,j).value 
Exit For
End If
Next

objWb.save
objWB.close
objExcel.Quit
set objExcel=nothing

End Function