Thanks All,
This is my result
************************************************** ************************
Public Function SearchProjectModulesCode(ByVal strFindString As String) As
String
On Error GoTo errHandling
Dim MyObject As Object
Dim MyMdl As Module
Dim iLoop, iObjectCount, iFound As Long
Dim strSearchString As String
SearchProjectModulesCode = "String '" & strFindString & "' found in
modules:" & Chr(13)
For Each MyObject In CurrentProject.AllModules
If FindInCode(MyObject.Name, strFindString) Then
SearchProjectModulesCode = SearchProjectModulesCode & Chr(13) & ">" &
MyObject.Name
iObjectCount = iObjectCount + 1
Next MyObject
SearchProjectModulesCode = SearchProjectModulesCode & Chr(13) & Chr(13) &
iObjectCount & " modules cheked!"
Exit Function
errHandling:
MsgBox Err.Number & " " & Err.Description
End Function
Function FindInCode(strModuleName As String, strSearchText As String) As
Boolean
Dim mdl As Module
Dim lngSLine As Long, lngSCol As Long
Dim lngELine As Long, lngECol As Long
Dim strLine As String, strNewLine As String
Dim intChr As Integer, intBefore As Integer, _
intAfter As Integer
Dim strLeft As String, strRight As String
Set mdl = Modules(strModuleName)
If mdl.Find(strSearchText, lngSLine, lngSCol, lngELine, lngECol) Then
FindInCode = True
Else
FindInCode = False
End If
Exit_FindAndReplace:
Exit Function
Error_FindAndReplace:
MsgBox Err & ": " & Err.Description
FindInCode = False
Resume Exit_FindAndReplace
End Function
************************************************** **********************
"Salad" <oi*@vinegar.com> wrote in message
news:_j*****************@newsread3.news.pas.earthl ink.net...
Filips Benoit wrote:
Dear All,
I'm looking for a function that does the same as the find-action in the
code-window.
Thanks,
Filip
Look at the Find method for the Module object in help. Also, look at
the code example for the Find method.