Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search an alphanumeric in a column and return true/false 2226 Excel Worksheet Functions 9 January 6th 09 09:17 AM
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 LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
Search column for value and return TRUE or FALSE Remote Desktop Connection hotkey Excel Worksheet Functions 8 July 13th 06 05:07 PM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM


All times are GMT +1. The time now is 10:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"