Try something like the following.
Sub AAA()
Dim FindWhat As String
Dim StartLine As Long
Dim EndLine As Long
Dim StartCol As Long
Dim EndCol As Long
Dim Found As Boolean
With Application.VBE
If .ActiveCodePane Is Nothing Then
MsgBox "No Code Pane Active"
Exit Sub
End If
With .ActiveCodePane
FindWhat = "findme"
StartLine = 0
EndLine = .CodeModule.CountOfLines
StartCol = 0
EndCol = 0
Found = .CodeModule.Find( _
target:=FindWhat, _
StartLine:=StartLine, _
startcolumn:=StartCol, _
EndLine:=EndLine, _
endcolumn:=EndCol, _
wholeword:=False, _
MatchCase:=False, _
PatternSearch:=False)
If Found = True Then
.SetSelection StartLine, StartCol, EndLine, EndCol
Else
MsgBox "Not Found"
End If
End With
End With
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
"D." wrote in message
oups.com...
Hi,
What's the code to find a code?
I would like to be able to click a button and it will take me to a
particular code in the vba viewer
Thanks