Dim strTem As String
Dim intTem As Integer
Dim sName() As String
Dim i As Integer
Dim j As Integer
Dim iTemp As Integer
Dim aa As Integer
Do
Randomize
intTem = Int(Rnd * (14 - 1)) + 1
If InStr(1, strTem, CStr(intTem)) = 0 Then
strTem = strTem + CStr(intTem) + "."
i = i + 1
If i > 5 Then Exit Do
End If
Loop
sName = Split(strTem, ".")
For i = 0 To UBound(sName) - 2
For j = i + 1 To UBound(sName) - 1
If Val(sName(i)) > Val(sName(j)) Then
iTemp = sName(i)
sName(i) = sName(j)
sName(j) = iTemp
End If
Next
Next
For i = 0 To UBound(sName()) - 1
Text1(i).Text = Format(sName(i), "00")
Next
Text2.Text = Format(Int(Rnd * (17 - 1)) + 1, "00")
aa = Val(Text1(0).Text) + _
Val(Text1(1).Text) + _
Val(Text1(2).Text) + _
Val(Text1(3).Text) + _
Val(Text1(4).Text) + _
Val(Text1(5).Text)
'If aa >= 90 And aa <= 100 Then
Open "C:\Sample.txt" For Append As #1
Print #1, Text1(0).Text & " " & Text1(1).Text & " " & Text1(2).Text & " " & Text1(3).Text & " " & Text1(4).Text & " " & Text1(5).Text & " " & Text2.Text & vbCrLf
Close #1
'End If
End Sub