Home test Word Vba Find Text
20 | 05 | 2012
This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade

Find Text PDF Print E-mail
User Rating: / 0
PoorBest 
Tutorials

 In word you can use the function below to search for a specific text. This particulair function has a option to choose if the search is case sensitive or not. 

 

     1 Function FindText(ByVal searchStr As String, Optional ByVal doMatchcase As Boolean = False) As Boolean

    2 

    3     '****************************************

    4     '*** Code from VisibleVisual.com ********

    5     '****************************************

    6 

    7     Selection.Find.ClearFormatting()

    8     With Selection.Find

    9         .Text = searchStr

   10         .Forward = True

   11         .Wrap = wdFindContinue

   12         .Format = False

   13         .Matchcase = doMatchcase

   14         .MatchWholeWord = False

   15         .MatchWildcards = False

   16         .MatchSoundsLike = False

   17         .MatchAllWordForms = False

   18     End With

   19 

   20     If Selection.Find.Execute = True Then

   21         FindText = True

   22     Else

   23         FindText = False

   24     End If

   25 

   26 End Function

   27 

   28 

   29 Sub TestFunction()

   30 

   31     MsgBox(FindText("VisibleVisual", True))

   32 

   33 End Sub

 

Attachments:
FileDescriptionFile sizeDownloads
Download this file (VBA Find Text Macro.doc)VBA Find Text SampleThis document contains a macro that can be used to search for specific string in text files.40 Kb123
 
This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade