If you have VB6 then you can do this:
Code:
Dim IntArr() As String
IntArr = Split(TheIntStringYouAreUsing, " ")
AmoutOfWordsInString = UBound(IntArr) + 1
But I think you would be much better off using a dynamic array to store these variables:
Code:
'(Any VB)
'Declaration section:
Dim IntArr() As Integer
'Somewhere in code:
'ElNum is the number of elements you want the array to have (in this case 5)
ElNum = 5
ReDim Preserve IntArr(ElNum) As Integer
'IntArr is now array which has 6 elements (0, 1, 2, 3, 4, 5)
So you can do this:
IntArr(0) = 1932
IntArr(1) = 3629
IntArr(2) = 2374
IntArr(3) = 8235
IntArr(4) = 6983
IntArr(5) = 217
If you want to add more elements just do this:
Code:
ReDim Preserve IntArr(7) As Integer
'You have already set 0,1,2,3,4, and 5
IntArr(6) = 6983
IntArr(7) = 217
To read the values, just do this
Code:
Debug.Print "Fifth element = " & IntArr(4)
Code:
'And to find the amount of elements in the array:
Debug.Print UBound(IntArr) & "Elements in array"
'Out: 7 Elements in array
'You must always add one to find the amount of elements in the array:
Debug.Print UBound(IntArr) + 1 & "Elements in array"
'Out: 8 Elements in array. That's better.
I hope this helps.
BTW: Since you are a new member, you don't really know how this forum works. A question like this should go in 'General Questions'. This forum is really only for complaints (hundred of complaints
) about the forum.