PeopleSoft Adoption Made Smooth & Simple!
On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool. Claim Your Free WalkMe Account Now
Private Sub Command5_Click() Dim Success As Boolean Dim Value As String Dim StringEntered As String StringEntered = "yjk65kg12dky" 'this will be textbox value entered by user Value = GetNumbers(StringEntered) If Val(Value) >= 5000 And Val(Value) <= 9900 Then 'now check if the correct letters are typed Success = True Else Success = False End If MsgBox Success End Sub Function GetNumbers(Value As String) As String 'extract and return numbers from a string Dim Index As Long Dim Digit As String Dim Final As String Dim Count As Long Count = 1 GetNumbers = space(Len(Value)) For Index = 1 To Len(Value) Digit = Mid(Value, Index, 1) If Digit Like "[0-9]" Then Mid(GetNumbers, Count, 1) = Digit Count = Count + 1 End If Next GetNumbers = Left(GetNumbers, Count - 1) End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.