Function FactUnique(MyStr) As Long
Dim i As Long, Dic As Object, Tmp As String, ProductFact, ArrItem
Set Dic = CreateObject("Scripting.Dictionary")
For i = 1 To Len(MyStr)
Tmp = Mid(MyStr, i, 1)
If Not Dic.exists(Tmp) Then
Dic.Add Tmp, 1
Else
Dic.Item(Tmp) = Dic.Item(Tmp) + 1
End If
Next
ProductFact = 1
ArrItem = Dic.items
For i = 0 To Dic.Count - 1
ProductFact = ProductFact * Application.Fact(ArrItem(i))
Next
FactUnique = Application.Fact(Len(MyStr)) / ProductFact
End Function
Dim i As Long, Dic As Object, Tmp As String, ProductFact, ArrItem
Set Dic = CreateObject("Scripting.Dictionary")
For i = 1 To Len(MyStr)
Tmp = Mid(MyStr, i, 1)
If Not Dic.exists(Tmp) Then
Dic.Add Tmp, 1
Else
Dic.Item(Tmp) = Dic.Item(Tmp) + 1
End If
Next
ProductFact = 1
ArrItem = Dic.items
For i = 0 To Dic.Count - 1
ProductFact = ProductFact * Application.Fact(ArrItem(i))
Next
FactUnique = Application.Fact(Len(MyStr)) / ProductFact
End Function