SkipVought
Programmer
Hey Gang,
From time to time I need to find strings in code in order to make modifications. It seems that Windows Explorer search does not "see" VBA code.
Is there a method for this kind of search?
Skip,
![[glasses] [glasses] [glasses]](/data/assets/smilies/glasses.gif)
for a NUANCE!
![[tongue] [tongue] [tongue]](/data/assets/smilies/tongue.gif)
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Sub FindInVBACode(SearchString As String, InWorkbook As Workbook)
Dim ix As Long
Dim vbc As VBIDE.VBComponent
For Each vbc In InWorkbook.VBProject.VBComponents
For ix = 1 To vbc.CodeModule.CountOfLines
Dim line As String
line = vbc.CodeModule.Lines(ix, 1)
If (InStr(line, SearchString) > 0) Then
MsgBox "Found " & SearchString & " at line " & ix & " of code module " & vbc.Name
End If
Next
Next
End Sub