Attribute VB_Name = "mod1Oefeningen" Option Explicit Sub Oefening1() Dim Arr(5) Dim i As Integer Arr(0) = "Tekst 6.txt" Arr(1) = "Tekst 4.txt" Arr(2) = "Tekst 5.txt" Arr(3) = "Tekst 1.txt" Arr(4) = "Tekst 2.txt" Arr(5) = "Tekst 3.txt" For i = LBound(Arr) To UBound(Arr) Debug.Print Arr(i) Next i End Sub Sub Oefening2() Dim Coll As Collection Dim i As Integer Set Coll = New Collection Coll.Add "Tekst 6.txt" Coll.Add "Tekst 4.txt" Coll.Add "Tekst 5.txt" Coll.Add "Tekst 1.txt" Coll.Add "Tekst 2.txt" Coll.Add "Tekst 3.txt" For i = 1 To Coll.Count Debug.Print Coll.Item(i) Next i End Sub Sub Oefening3() Dim Arr() Dim i As Integer Dim j As Integer Dim s As String Arr = Array("Tekst 6.txt", "Tekst 4.txt", "Tekst 5.txt", "Tekst 1.txt", "Tekst 2.txt", "Tekst 3.txt") For i = LBound(Arr) To UBound(Arr) - 1 For j = i + 1 To UBound(Arr) If Arr(i) > Arr(j) Then s = Arr(j) Arr(j) = Arr(i) Arr(i) = s End If Next j Next i For i = LBound(Arr) To UBound(Arr) Debug.Print Arr(i) Next i End Sub
Download hier het bestand.