grayghost69
asked on
Write VBA that will search through other VBA code
I am trying to write a VBA tool within a form, that will search through all of the VBA code within all forms and modules for a specific string. This would be like using the Find tool, only using VBA to initiate it.
I was thinking that I could just reference the Find tool, but I couldn't find how to do that.
This is in Access 97
I was thinking that I could just reference the Find tool, but I couldn't find how to do that.
This is in Access 97
ASKER
I think it would help if I could see an example of how it would load each of the forms from the forms collection, then search it.
ASKER
Here is the code that I am using to read each of the forms in currently.
Sub Search()
Dim db As Database
Dim cont As Container
Dim frm As Document
Set db = CurrentDb()
Set cont = db.Containers("Forms")
For Each frm In cont.Documents
str = frm.Name
MsgBox str
Next frm
End Sub
Sub Search()
Dim db As Database
Dim cont As Container
Dim frm As Document
Set db = CurrentDb()
Set cont = db.Containers("Forms")
For Each frm In cont.Documents
str = frm.Name
MsgBox str
Next frm
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Run the sub tryme() and it will print all of your form names to the debug window and whether they contain the string "EnumWindows" or not. You can change the "EnumWindows" to the string you want to find.
Thanks!
Joe
Thanks!
Joe
ASKER
That's close enough to what I need. I got the part answered that I needed, thank.
ASKER
Close enough to what I need, I can manipulate it to my purposes.
Thanks,
Brian
Thanks,
Brian
Glad to help!
Thanks!
Joe
Thanks!
Joe
Thanks!
Joe