<< Click to Display Table of Contents >>
RemoveItem |
RemoveItem(pvargIndex)
Removes items from a List. This method has the pvargIndex parameter, which specifies an item to exclude, starting at 0 (zero). That is, the first element is 0 (zero), the second element is 1 (one), and so on. The next script contains an example of using this method.
Sub CommandButton2_Click()
List1.SetFocus
' Checks if this list has selected items
If List1.ListCount >= 1 Then
' If there is no selection,
' selects the last item on this list.
If List1.ListIndex = -1 Then
List1.ListIndex = List1.ListCount – 1
End If
List1.RemoveItem(List1.ListIndex)
End If
End Sub