I just wonder whether there are any built-in functions/methods to delete/remove/kill or add/insert/put elements of an array. So far, what i can do is only using assignment methods to fulfil those tasks.
If you treat the array as a collection you can get much more functionality. Unfortunately, I know that cos I saw a piece of code at work, never used it, so that is as much as I can remember.
But it gives you a direction to go in until someone comes up with something better.
Const Words As String = "Your,Words,In,Here"
Private mCol As Collection
Private Sub Command1_Click()
Dim strWord As String
strWord = mCol.Item(Int(Rnd * mCol.Count) + 1)
MsgBox strWord
mCol.Remove strWord
MsgBox "Now only " & mCol.Count & " words in collection"
End Sub
Private Sub Form_Load()
Dim lngIndex As Long
Dim strWoof() As String
strWoof = Split(Words, ","
Set mCol = New Collection
For lngIndex = 0 To UBound(strWoof)
mCol.Add strWoof(lngIndex), strWoof(lngIndex)
Next lngIndex
MsgBox mCol.Count & " words in collection"
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.