Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Search in VBE (True/False Solution)
Does anyone know how to search for a word in VBA modules? That is, I want to
do a search for a given word. I want to have a binary solution (True/False). I want to be able to search all modules in a given workbook. I would also want to be able to search workbook and worksheet modules as well. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search an alphanumeric in a column and return true/false | Excel Worksheet Functions | |||
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu | Excel Discussion (Misc queries) | |||
Search for 2 true arguments and return true or false | Excel Discussion (Misc queries) | |||
Search column for value and return TRUE or FALSE | Excel Worksheet Functions | |||
Function to return True/False if all are validated as True by ISNU | Excel Worksheet Functions |