Sub SortIndex Dim datIndex, lngNumber, EveryNumber, boolLoopAgain ReDim arrstrCheck(lngIndex - 1) For datIndex = 0 To lngIndex - 1 Do boolLoopAgain = False lngNumber = RandomNumber For Each EveryNumber In arrstrCheck If CStr(lngNumber) = EveryNumber Then boolLoopAgain = True Exit For End If Next Loop While boolLoopAgain ReDim Preserve arrstrDate(datIndex) arrstrDate(datIndex) = lngNumber arrstrCheck(datIndex) = lngNumber Next End Sub
Sub ShowAirCraft Dim strResult, datIndex For datIndex = 0 To lngIndex - 1 strResult = strResult & arrstrAirCraft(arrstrDate(datIndex)) & "/" Next strResult = Left(strResult, Len(strResult) - 1) MsgBox strResult End Sub
Function RandomNumber Randomize RandomNumber = Round((lngIndex - 1) * Rnd) End Function
Function GetName(Counter) Dim intButton, boolLoopAgain Do boolLoopAgain = False GetName = InputBox("Please entry the aircraft name.", Counter) If GetName = Empty Then intButton = MsgBox("Forbid nothing. Again?", vbYesNo) If intButton = 6 Then boolLoopAgain = True If intButton = 7 Then WScript.Quit End If Loop While boolLoopAgain End Function
Function GetCount Dim intButton, boolLoopAgain Do boolLoopAgain = False GetCount = InputBox("How many aircraft name do you want to entry?") If Not IsNumeric(GetCount) Or GetCount = Empty Then intButton = MsgBox("The count can't be word. Again?", vbYesNo) If intButton = 6 Then boolLoopAgain = True If intButton = 7 Then WScript.Quit Else GetCount = Round(GetCount) End If Loop While boolLoopAgain End Function