Dim sQuestions() As String

Dim c As Long

Private Sub Command1_Click()

Dim lR As Long

Dim n As Long

Dim k As Long

lR = Int(c * Rnd + 1)

If c = 0 Then MsgBox "no more questions": Exit Sub

n = 0

k = 0

While n < lR

k = k + 1

If sQuestions(1, k) = "" Then

n = n + 1

End If

Wend

Text1.Text = sQuestions(0, k)

sQuestions(1, k) = "N"

c = c - 1

End Sub

Private Sub Form_Load()

Randomize CLng(Now)

ReDim sQuestions(1, 0)

Open "c:\questions.txt" For Input As #1

Do Until EOF(1)

c = c + 1

ReDim Preserve sQuestions(1, c)

Line Input #1, sQuestions(0, c)

Loop

Close #1

End Sub