Thread: Uppercase Check
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Duncan[_5_] Duncan[_5_] is offline
external usenet poster
 
Posts: 290
Default Uppercase Check

On 12 Mar, 14:00, "Dan R." wrote:
On Mar 12, 8:46*am, Duncan wrote:





Hi Guys,


Been a long while since I posted on here!


Does anyone know how to look at a textbox, and see if at least one of
the letters is uppercase?


Basically I need to try to recreate microsofts password complexity doo-
dah to check my textbox against, essentially at least 6 charecters,
and two of them have to be either uppercase, number or charecter. (not
both of the same),... anyway thats hard to explain properly and doesnt
really matter at this early stage but I am sure you get what I am
trying to do.


The first bit I want to tackle is to see if there is an uppercase
letter. Any ideas?


Many thanks in advance


Duncan


Try something like this:

mystr = "ssSss"
For i = 1 To Len(mystr)
* If Mid(mystr, i, 1) = UCase(Mid(mystr, i, 1)) Then
* * Debug.Print i
* End If
Next

--
Dan- Hide quoted text -

- Show quoted text -


Hi Dan,

Worked perfectly, thanks. I used it in the following:

mystr = Password1.Text
For i = 1 To Len(mystr)
If Mid(mystr, i, 1) = UCase(Mid(mystr, i, 1)) Then
Checky = Checky + 1
GoTo Nxt1
End If
Next
Nxt1:
For i = 1 To Len(mystr)
If Mid(mystr, i, 1) = IsNumeric(Mid(mystr, i, 1)) Then
Checky = Checky + 1
GoTo Nxt2
End If
Next
Nxt2:
For i = 1 To Len(mystr)
If Mid(mystr, i, 1) = LCase(Mid(mystr, i, 1)) Then
Checky = Checky + 1
GoTo Nxt3
End If
Next
Nxt3:

Then I will check to see if Checky = 3

Many thanks again

Duncan