473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Find a string in all the code using a function

Dear All,

I'm looking for a function that does the same as the find-action in the
code-window.

Thanks,

Filip
Nov 13 '05 #1
5 1492
look up the InStr() function....
"Filips Benoit" <be***********@pandora.be> wrote in message
news:R%***********************@phobos.telenet-ops.be...
Dear All,

I'm looking for a function that does the same as the find-action in the
code-window.

Thanks,

Filip

Nov 13 '05 #2
Yes but how to loop all code of all forms, modules and report

filip

"miTchell" <mitchell@"no_spam".topsideinc.com> wrote in message
news:1097170773.mi5x0iHyhXbakayNlVJSgw@teranews...
look up the InStr() function....
"Filips Benoit" <be***********@pandora.be> wrote in message
news:R%***********************@phobos.telenet-ops.be...
Dear All,

I'm looking for a function that does the same as the find-action in the
code-window.

Thanks,

Filip


Nov 13 '05 #3
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.
Nov 13 '05 #4
Here is an incomplete bit of code that I am working on, nicked from
somewhere

Function GetModuleInfo(ObjName As String, SearchStg As String) As Boolean

Dim Mdl As Module
Dim lngSLine As Long, lngSCol As Long
Dim lngELine As Long, lngECol As Long, lngENameCol As Long
Dim strLine As String
Dim ObjectName As String
Dim ObjectTypeID As Long

' Return reference to Module object.
DoCmd.OpenModule (ObjName)
' Search for string.

Set Mdl = Modules(ObjName)
NextMLine:

While lngSLine < Mdl.CountOfLines
' Still this module
lngSLine = LastLine
If Mdl.Find(SearchStg, lngSLine, lngSCol, lngELine, lngECol) Then
' Found
'..... Do something
end if
Wend

HTH
Phil

"Filips Benoit" <be***********@pandora.be> wrote in message
news:vd***********************@phobos.telenet-ops.be...
Yes but how to loop all code of all forms, modules and report

filip

"miTchell" <mitchell@"no_spam".topsideinc.com> wrote in message
news:1097170773.mi5x0iHyhXbakayNlVJSgw@teranews...
look up the InStr() function....
"Filips Benoit" <be***********@pandora.be> wrote in message
news:R%***********************@phobos.telenet-ops.be...
> Dear All,
>
> I'm looking for a function that does the same as the find-action in the
> code-window.
>
> Thanks,
>
> Filip
>
>



Nov 13 '05 #5
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.

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Madestro | last post by:
Hi guys, I am making a small program to retrieve e-mails from POP accounts. I got all the e-mail parsing stuff figured out, but I cannot seem to come up with a way to find out which e-mails are...
3
by: Chris Mantoulidis | last post by:
I posted this here one day ago but it seems like it hasn't been put up for some unknown reason. That gives me a chance to say things a bit better in this post. 1st of all let's desribe the...
1
by: Saeed Amrollahi | last post by:
Dear All C++ Programmers Hello I am Saeed Amrollahi. I am a software engineer in Tehran Sewerage Company. I try to use std::map and map::find member function. I use Visual Studio .NET. my...
22
by: MLH | last post by:
I have some audio help files that play fine from within Access 97 and Access 2.0. Both are running on a Windows XP box. But I do not know what program plays the files. If I click Start, Run and...
12
by: Rubbrecht Philippe | last post by:
Hi there, According to documentation I read the ArrayList.IndexOf method uses the Object.Equals method to loop through the items in its list and locate the first index of an item that returns...
5
by: Mike Labosh | last post by:
In VB 6, the Form_QueryUnload event had an UnloadMode parameter that let me find out *why* a form is unloading, and then conditionally cancel the event. In VB.NET, the Closing event passes a...
2
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
0
by: kloplop321 | last post by:
I found this code(vb only) and it does about the same thing(in vb, not vb .NET 2005) Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute...
9
by: Satish Itty | last post by:
How do I write the following c# code in vb Product FindProduct(string code) { List<Productproducts = getProducts(); return products.Find(delegate(Product bo) { return bo.Code == code; }); }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.