'VBA ListBox RemoveItem Unspecified Error
When I try to call remove item on my listbox, I get '-2147467259 (80004005)' unspecified error.
My rowsource property is blank. I add the items originally through .additem in a module and I call the code below from the form that the listbox is in:
ListBox1.RemoveItem CInt(index)
The get the error on that line.
Solution 1:[1]
The item you are trying to remove is selected. Add the following statement prior to attempting to remove the item
Listbox1.Selected(index) = false
Solution 2:[2]
Listbox1.Selected(index) = false
is correct, but remember to replace by an integer variable because the .listindex value disappears after deselection, i.e.:
dim mylistindex as integer
With Me.Listvariables
mylistindex = .ListIndex
.Selected(.ListIndex) = False
.RemoveItem (mylistindex)
End With
Solution 3:[3]
Just replace your FM20.DLL with the version 15.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ebrts |
Solution 2 | karel |
Solution 3 | Matheus |