Public Function checkSymbol(InputString As String) As Boolean
Dim blnChecked As Boolean
blnChecked = False
For i = 1 To Len(InputString)
If Asc(Mid(InputString, i, 1)) >= 32 And Asc(Mid(InputString, i, 1)) <= 47 Then
blnChecked = True
Exit For
End If
Next
checkSymbol = blnChecked
End Function
Public Function checkSymbol(InputString As String) As Boolean
Dim i As Integer
Dim blnChecked As Boolean
blnChecked = False
For i = 1 To Len(InputString)
If (Asc(Mid(InputString, i, 1)) >= 32 And Asc(Mid(InputString, i, 1)) <= 47) _
Or (Asc(Mid(InputString, i, 1)) >= 58 And Asc(Mid(InputString, i, 1)) <= 64) _
Or (Asc(Mid(InputString, i, 1)) >= 91 And Asc(Mid(InputString, i, 1)) <= 96) _
Or (Asc(Mid(InputString, i, 1)) >= 123 And Asc(Mid(InputString, i, 1)) <= 126) _
Then
blnChecked = True
Exit For
End If
Function ValidPassword(ByVal str As String) As Boolean
With CreateObject("VBScript.RegExp")
.Global = False
.Pattern = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*\W)[\w\d\W]{8,15}$"
ValidPassword = .Test(str)
End With
End Function
Sub TestPasswords()
Dim pwArr As Variant
Dim pw As Variant
pwArr = Array("Aa8*DEFGHIJ", "murray_ee_2019", "Murray_EE*2019", "HELLO123_*", "hello world!", "-*/+Aa123 ", "aA123_#+", "~@#%^&()[]Aa1")
For Each pw In pwArr
If ValidPassword(pw) Then
MsgBox "'" & pw & "' is good Password."
Else
MsgBox "'" & pw & "' is bad password."
End If
Next pw
End Sub
https://access-programmers
https://stackoverflow.com/
each illustrate one of these approaches.