Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

Any way to word search in a Text Box?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lbbss - 09 Dec 2007 19:43 GMT
I have text info in my excel text box, but I can't do a word search in
the text box.   Any ideas.   What about inside my cell notes?
Coder1215 - 09 Dec 2007 22:34 GMT
> I have text info in my excel text box, but I can't do a word search in
> the text box.   Any ideas.   What about inside my cell notes?

You could convert the value into string and search using Instr for
e.g.
Can you post smoe code please?
Vergel Adriano - 10 Dec 2007 02:32 GMT
maybe a subroutine like this...

Sub FindInTextBox(strFind As String)
   
   Dim s As Shape
   
   For Each s In ActiveSheet.Shapes
       If s.Type = msoTextBox Then
           If InStr(1, s.OLEFormat.Object.Caption, strFind, vbTextCompare)
> 0 Then
               MsgBox strFind & " found in " & s.Name
               s.Select
               Exit For
           End If
       End If
   Next s
   
End Sub

Signature

Hope that helps.

Vergel Adriano

> I have text info in my excel text box, but I can't do a word search in
> the text box.   Any ideas.   What about inside my cell notes?
lbbss - 11 Dec 2007 02:54 GMT
I tried pasting that routine into a vba macro, but it crashed before
the 0> Then line.  Not sure how that macro should work.  Where would
you input the word you are searching for?  tx
Vergel Adriano - 11 Dec 2007 03:10 GMT
The newsreader wrapped the code.  Make sure the "If" up to the ">0 Then" is
on one line..  This should be on one line:

If InStr(1, s.OLEFormat.Object.Caption, strFind, vbTextCompare) > 0 Then

To use it, you would pass the word you are searching for as a parameter.  
For example, to look for "string1":

FindInTextBox "string1"

It will search for "string1" in text boxes in the active sheet.

Signature

Hope that helps.

Vergel Adriano

> I tried pasting that routine into a vba macro, but it crashed before
> the 0> Then line.  Not sure how that macro should work.  Where would
> you input the word you are searching for?  tx
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.