PC Review


Reply
Thread Tools Rate Thread

Any way to word search in a Text Box?

 
 
lbbss
Guest
Posts: n/a
 
      9th Dec 2007
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?
 
Reply With Quote
 
 
 
 
Coder1215
Guest
Posts: n/a
 
      9th Dec 2007
On 9 Gru, 20:43, lbbss <labi...@yahoo.com> wrote:
> 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?

 
Reply With Quote
 
Vergel Adriano
Guest
Posts: n/a
 
      10th Dec 2007
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




--
Hope that helps.

Vergel Adriano


"lbbss" wrote:

> 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?
>

 
Reply With Quote
 
lbbss
Guest
Posts: n/a
 
      11th Dec 2007
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
 
Reply With Quote
 
Vergel Adriano
Guest
Posts: n/a
 
      11th Dec 2007
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.




--
Hope that helps.

Vergel Adriano


"lbbss" wrote:

> 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
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
search text files for a certain word Fan924 Microsoft Excel Programming 3 22nd Jan 2010 05:37 AM
Help! Text word search. Michelle Microsoft Excel Misc 3 20th Sep 2009 04:06 PM
Search text field for word =?Utf-8?B?R2VycnlL?= Microsoft Excel Misc 2 14th Sep 2007 03:42 PM
how do I tell word to search outside the text box if insertion pt is in it rllewis Microsoft Word Document Management 2 15th Dec 2006 01:51 AM
word text search andy Microsoft Word Document Management 1 4th Aug 2004 10:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:34 PM.