DataTable.ImportSheet "\\<shared drive>\QTP Scripts\Input Excel\Key_CC_Data.xls" ,"Data" ,"Global"
Dim val3, RowCnt3
RowCnt3 = DataTable.GetRowCount
For i = 1 To RowCnt3
If i => 1 Then
OracleListOfValues("Credit Card").Select "Visa"
'OracleListOfValues("Credit Card").Select val3
'OracleListOfValues("Credit Card").Enter val3
Problem is I don't want the hard coded value of "Visa" in my QTP script, I want to be able to use other values from my excel spreadsheet at a later date, Ex: American Express, Master Card, etc.
Now in my datasheet "Visa" is on row 1. And I made it to equal variable val3. But in the above code if I use:
I have already ran a msgbox on val3 and it comes back as Visa. And Visa is a choice on the dropdown list.
How can I use a variable to select from a dropdown list?
PS I did search this forum and the web for the answer and didn't find it.
Re: How can I associate variables to a dropdown list?
Try the below code..
vListVal_ToBeSelected = "Visa"
Set ObjList = Browser("").Page("").List("Credit Card")
vListItemsCount = ObjList.GetRoProperty("items count")
For vCount = 0 to vListItemsCount-1
vItem = ObjList.GetItem (vCount+1)
If (StrComp(Trim(vItem ),Trim(vListVal_ToBeSelected),vbTextCompare)=0 Then
ObjList.Select "#"& vCount