Aca te dejo con tu base de codigo, indestado y un poco mejorado:
Código
Private Sub Command1_Click() Dim cinconumeros(1 To 5) As Integer Dim temporal As Integer Dim I, J, X, Y As Integer J = 1 progreso.Max = txtcantidad For contador = 1 To txtcantidad progreso.Value = contador Randomize Timer For I = 1 To 5 If I = 1 Then cinconumeros(J) = Int((50 * Rnd) + 1) J = J + 1 Else retorno: temporal = Int((50 * Rnd) + 1) For X = 1 To 5 If temporal = cinconumeros(X) Then GoTo retorno End If Next X cinconumeros(J) = temporal J = J + 1 End If Next I For Y = 0 To 4 txt(Y).Text = txt(Y).Text + "," + Str(cinconumeros(Y + 1)) Next Next MsgBox ("Los datos han sido generados") End Sub Private Sub Command2_Click() Dim Z As Long Open txtruta For Append As #1 For Y = 0 To 4 Print #1, txt(Z) Next Close #1 MsgBox ("Los datos se han pasado al archivo") End Sub
GRACIAS POR LEER!!!