From: leerem on 30 Apr 2010 07:19 Great, that's the type of code that should do it! I'll add it in and let you know..... Many thanks Lee "Helmut Meukel" wrote: > "leerem" <leerem(a)discussions.microsoft.com> schrieb im Newsbeitrag > news:28E52688-81C4-4C61-B966-123C766B054D(a)microsoft.com... > > Hi, > > I have a userform that users enter the Drivers Name of the vehicle > > into, plus other data. User's being how they are, tend to enter other > > meanings as well, I've managed to sort out the unwelcome messages and any > > numerical entries, but how do i prevent an entry such as "pppppppppp", > > "kkkkkkkkkk" or even something like "po po po po" as an example. > > > > I've tried coding this but have had no luck. to be honest I'm a bit baffled > > as to how to overcome this. Please help > > > > Regards Lee > > > > > I don't think you can rule out all bogus entries. You can try, but... > Out of the top of my head: use Mid(entry$, p, 1) in a for next loop like > > Function IsBogus(entry as string) > dim ch as string > for p = 1 to len(entry) - 2 > ch = mid(entry, p, 1) > if mid(entry, p, 3) = String(3, ch) then > IsBogus = true > exit function > endif > next p > ... > End Function > > How to deal with names like > Donald Duck, > Mickey Mouse, > Jane Doe, > > you can make a list to check against, but.. > > Helmut. > > > > . >
From: Helmut Meukel on 30 Apr 2010 10:58 To catch things like "po po po po" you could use a similar approach, step with mid(entry, p, 3) through the string and compare with mid(entry, p+3, 3) For entries like "sdfghjkl" you can check for consecutive consonants, step through the string with mid(entry, p, 1) and count the consonants, reset the counter every time it's a vowel or a space. If counter is 4 (or 5) then it's bogus. To allow for some eastern european names 5 might be better. Helmut. "leerem" <leerem(a)discussions.microsoft.com> schrieb im Newsbeitrag news:B5C5CB96-5569-450C-8F8A-B4A25B9AC979(a)microsoft.com... > Great, that's the type of code that should do it! I'll add it in and let you > know..... > Many thanks > > Lee > > > "Helmut Meukel" wrote: > >> "leerem" <leerem(a)discussions.microsoft.com> schrieb im Newsbeitrag >> news:28E52688-81C4-4C61-B966-123C766B054D(a)microsoft.com... >> > Hi, >> > I have a userform that users enter the Drivers Name of the vehicle >> > into, plus other data. User's being how they are, tend to enter other >> > meanings as well, I've managed to sort out the unwelcome messages and any >> > numerical entries, but how do i prevent an entry such as "pppppppppp", >> > "kkkkkkkkkk" or even something like "po po po po" as an example. >> > >> > I've tried coding this but have had no luck. to be honest I'm a bit baffled >> > as to how to overcome this. Please help >> > >> > Regards Lee >> > >> >> >> I don't think you can rule out all bogus entries. You can try, but... >> Out of the top of my head: use Mid(entry$, p, 1) in a for next loop like >> >> Function IsBogus(entry as string) >> dim ch as string >> for p = 1 to len(entry) - 2 >> ch = mid(entry, p, 1) >> if mid(entry, p, 3) = String(3, ch) then >> IsBogus = true >> exit function >> endif >> next p >> ... >> End Function >> >> How to deal with names like >> Donald Duck, >> Mickey Mouse, >> Jane Doe, >> >> you can make a list to check against, but.. >> >> Helmut. >> >> >> >> . >>
First
|
Prev
|
Pages: 1 2 Prev: XL2007 (or 2003): Triggering SelectionChange event Next: Help with error on PasteSpecial |