Array Element

In array have a big message like ("God is Great") .I want to split the words and stored into the different variables . a=God, b=is and c=Great.
pls give me a solution
anp_mcaAsked:
Who is Participating?
 
butch_18445Connect With a Mentor Commented:
try this
Dim Ar() As String, S As String
 
S = "God is Great"
 
Ar() = Split(S, " ")
 
Debug.Print Ar(0) 'prints God
Debug.Print Ar(1) 'prints is
Debug.Print Ar(2) 'prints Great

Open in new window

0
 
anp_mcaAuthor Commented:
Thank you for your quick reply
array have lot of files details
ex:
a(0)=name, size, date, type and permission
a(1)=
.
.
a(n)=


I want to display the values in List View control . I need the details displayed in seperatly. consider this
0
 
butch_18445Commented:
well, you can use Split() like above to split into an array, then to add to a listview, you would do something like this.  if Ar() is your array, then:
Dim i As Integer, i2 As Integer
 
i = ListView1.ListItems.Count + 1
 
ListView1.ListItems.Add i, , Ar(0)
 
For i2 = 1 To UBound(Ar)
    ListView1.ListItems(i).SubItems(i2) = Ar(i2)
Next

Open in new window

0
 
anp_mcaAuthor Commented:
Ok
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
All Courses

From novice to tech pro — start learning today.