Dim nRange As Integer
Dim nDeep As Integer
Dim stString As String
Dim st1 As String
Dim st2 As String
Private Sub Command1_Click()
nRange = 3
stString = "abcd"
st2 = ""
Start (st2)
End Sub
Sub Start(stPrv As String)
Dim i
Dim stPrivate As String
nDeep = nDeep + 1
If nDeep = nRange + 1 Then nDeep = nDeep - 1: GoTo SkipThisLayer
For i = 1 To Len(stString)
stPrivate = Mid(stString, i, 1)
If InStr(stPrv, stPrivate) = 0 Then
st1 = stPrv + stPrivate
If nDeep = nRange Then MsgBox st1
Start (st1)
End If
Next i
nDeep = nDeep - 1
SkipThisLayer:
End Sub
这回保证没有错:
Dim nRange As Integer
Dim nDeep As Integer
Dim stString As String
Dim st1 As String
Dim st2 As String
Private Sub Command1_Click()
nRange = 3
stString = "abcd"
st2 = ""
Start (st2)
End Sub
Sub Start(stPrv As String)
Dim i
Dim stPrivate As String
nDeep = nDeep + 1
If nDeep = nRange + 1 Then nDeep = nDeep - 1: GoTo SkipThisLayer
For i = 1 To Len(stString)
stPrivate = Mid(stString, i, 1)
If InStr(stPrv, stPrivate) = 0 Then
st1 = stPrv + stPrivate
If nDeep = nRange Then MsgBox st1
Start (st1)
End If
Next i
nDeep = nDeep - 1
SkipThisLayer:
End Sub