Without knowing what it's doing wrong, it's hard to say what errors you have. A couple of obvious things I noticed, strstore should be declared as Boolean not String, and strpattern should be declared as String not Boolean. In fact for efficiency you should probably try to avoid declaring variables inside a loop. The loop has the same scope as the sub routine. Declaring the variables inside the loop means a lot of extra work for your program, because it will declare the variables each time on each cycle of the loop. And finally, a string like strpattern that won't change can be declared as a Const
tinstaafl
Nearly a Posting Virtuoso
1,289 posts since Jun 2010
Reputation Points: 341
Solved Threads: 223
Skill Endorsements: 14
If you are only interested in the total number of vowels and not the number of each vowel then a simpler approach is
Dim str As String = "the quick brown fox jumped over the lazy dog"
Dim numVowels As Integer = 0
For Each ch As Char In str.ToUpper.ToCharArray
If InStr("AEIOUY", ch) > 0 Then numVowels += 1
Next
MsgBox("number of vowels = " & numVowels)
Reverend Jim
Carpe per diem
3,584 posts since Aug 2010
Reputation Points: 561
Solved Threads: 445
Skill Endorsements: 32