I have a piece of code which searches for a specific word in Modules and then list them. The Problem is the word is not searched and found by this piece of code. Every time 0 numbers of word are searched by this piece of code. How should I modify it that it should search the specific word and list it?I dont know where I am making the mistake....
Code:
Public Sub Command41_Click()
On Error GoTo Err_Command27
Dim lngCounterA As Long, lngCounterB As Long, lngCounterC As Long
Dim modModule As Module
Dim zahl
Dim zahl1
Dim zahl2
For lngCounterA = 0 To Modules.Count - 1
Set modModule = Modules.Item(lngCounterA)
zahl = 0
'Debug.Print "Number of Modules " & lngCounterA & ""
With modModule
For lngCounterB = 1 To .CountOfLines
If Trim(.Lines(lngCounterB, 1)) = "EOF" Then
' .ReplaceLine lngCounterB, "Washington"
zahl = zahl + 1
End If
Next lngCounterB
' Debug.Print "EOF comes in Module" & modModule & " " & zahl & " times."
zahl1 = 0
For lngCounterC = 1 To .CountOfLines
If Trim(.Lines(lngCounterC, 1)) = "EOF" Then
' .ReplaceLine lngCounterC, "Washington"
zahl1 = zahl1 + 1
End If
Next lngCounterC
End With
'Debug.Print "Recordset comes in " & modModule & " " & zahl1 & " times."
Me.Text28 = Me.Text28 & vbNewLine & "EOF comes in Module" & modModule & " " & zahl1 & " times."
Next lngCounterA
Exit_Command27:
Exit Sub
Err_Command27:
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_Command27
End Sub