864
社区成员




Option Explicit
Private a(1 To 6, 1 To 21) As String
Private hFile As Integer
Private Sub Search(ByVal FreeCell As String, ByVal Level As Long)
Dim sNew As String
Dim i As Long
For i = 1 To 21
If Left$(a(Level, i), 1) = Right$(FreeCell, 1) Then
sNew = FreeCell & Right$(a(Level, i), 1)
If Level = 6 Then
Print #hFile, sNew
Else
Search sNew, Level + 1
End If
End If
Next
End Sub
Private Sub Command1_Click()
Dim i As Long
hFile = FreeFile()
Open "C:\temp\FreeCell.txt" For Output Access Write As #hFile
For i = 1 To 21
Search a(1, i), 2
Next
Close #hFile
End Sub