Ciao a tutti, sono alle prime armi e vorrei creare un generatore di stringhe..niente di complicato per voi
Function RandomString(ByVal mask As String) As String
Dim i As Integer
Dim acode As Integer
Dim options As String
Dim char As String
RandomString = mask
For i = 1 To Len(mask)
char = Mid$(mask, i, 1)
Select Case char
Case "?"
char = Chr$(1 + Rnd * 127)
options = ""
Case "#"
options = "0123456789"
Case "A"
options = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Case "N"
options = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0" _
& "123456789"
Case "H"
options = "0123456789ABCDEF"
Case Else
options = ""
End Select
If Len(options) Then
char = Mid$(options & Right$(options, 1), 1 + Int(Rnd * Len(options) _
), 1)
End If
Mid(RandomString, i, 1) = char
Next
End Function
Questo è il modulo che ho.
Coem lo devo continuare o modificare ?