Drawing without replacement(編號:3925)

Drawing without replacement
I hope someone can help me to solve my problem.
I want to use VB to write a game program, so that it can give out 6 random number betweeb 47 numbers. I want to make it as drawing without replacement, so my program have to check that is the number selected is the same as any number appear b4? However it still cannot work.
Who can help me?
Private Sub Command1_Click()
Const maxnum = 6
Const totalnum = 47
Dim Num(maxnum) As Integer
Dim i, temp As Integer
Dim SameNum As Boolean
NoSameNum = True
i = 1
j = 1
Do While i <= maxnum
temp = Fix(Rnd * totalnum) + 1
  Num(i) = temp
  Do While NoSameNum = True
    For j = 1 To maxnum
      If Num(i) = Num(j) Then
        NoSameNum = False
      End If
    Next j
    Print Num(i)
    i = i + 1
  Loop
Loop
End Sub