Tuesday, March 27, 2012

Function to Select Item from weblist even you pass the item string partially.

Below function to select item from the list, even if you pass the string partially.

''*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
''* Function : Select_Itm_FromList(ActObject, Itm)
''* Description : Selects desired item from the list, even if you pass the item value partially
''* Developed By : Baba Fakruddin D
''* Developed On : 21-Mar-2012
''* Input : WebList Object, Selected item string
''* Output : Boolean
''* Syntax : Call Select_Itm_FromList(WebList Object, "Item_partial string")
''*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Function Select_Itm_FromList(ActObject, Itm)
 Dim bln_Flag, i, act_Comp
 bln_Flag = False
 For i = 0 to ActObject.GetROProperty("items count")-1
  act_Comp = UCase(Trim(ActObject.GetItem(i+1)))
  If Instr(act_Comp,UCase(Trim(Cstr(Itm)))) Then             
   ActObject.Select "#"&i
   bln_Flag = True
   Exit For
  End If
 Next
 If Not bln_Flag Then
  Select_Itm_FromList = False
 Else
  Select_Itm_FromList = True
 End If
End Function
''*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


"A good threat is worth a thousand tests" - Boris Beizer

No comments:

There was an error in this gadget