Can anyone help me to create a code to count how many words that are greater than 6? I am creating a readability test to calculate number of words etc. from three differente txt files. This is from my third and last private function. All help appreciated big time! :)
I have translated some of the words in the coding to make it easier to understand what it does...
Option Compare Database
Option Explicit
Private Const ordDeler As String = ",:;.!?"
`Private Function findLongWords(ByVal bok As String) As Double
Dim tegn As String, fil As String, linje As String
Dim fnr As Integer, i As Integer
Dim numberOfZeroSpace As Long, numberOfWords As Long, numberOfLongWords As Long
fnr = FreeFile
fil = CurrentProject.Path & "/" & bok & ".txt"
numberOfWords = 0
numberOfLongWords = 0
numberOfZeroSpace = 0
Open fil For Input As #fnr
Do While Not EOF(fnr)
Line Input #fnr, linje
For i = 1 To Len(linje)
tegn = Mid(linje, i, 1)
If InStr(1, ordDeler, tegn) > 6 Then
numberOfLongWords = numberOfZeroSpace
Else
numberOfLongWords = numberOfLongWords + 1
End If
Next i
Loop
findLongWords = numberOfLongWords
End Function`