View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
michelxld[_14_] michelxld[_14_] is offline
external usenet poster
 
Posts: 1
Default Word Search in VBE (True/False Solution)


Hello

you may try


Sub rechercheVBE()
'activate Visual basic For Application Extensibility 5.3
Dim i As Integer, x As Integer
Dim Fichier As String, Recherche As String, Msg As String
Dim Ligne As String
Dim VBCmp As VBComponent

Fichier = "TheWorkbook.xls"
Recherche = "theWord"

For Each VBCmp In Workbooks(Fichier).VBProject.VBComponents
Msg = VBCmp.Name

x =
Workbooks(Fichier).VBProject.VBComponents(Msg).cod emodule.CountOfLines

For i = 1 To x
Ligne =
Workbooks(Fichier).VBProject.VBComponents(Msg).cod emodule.Lines(i, 1)

If InStr(1, Ligne, Recherche, vbTextCompare) Then
MsgBox "True"
Exit Sub
End If

Next

Next VBCmp
MsgBox "False"
End Sub



regards
michel


--
michelxld
------------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...o&userid=17367
View this thread: http://www.excelforum.com/showthread...hreadid=387484