Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Any way to word search in a Text Box?

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Any way to word search in a Text Box?

On 9 Gru, 20:43, 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?


You could convert the value into string and search using Instr for
e.g.
Can you post smoe code please?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Any way to word search in a Text Box?

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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Any way to word search in a Text Box?

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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Any way to word search in a Text Box?

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
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
Help! Text word search. Michelle Excel Discussion (Misc queries) 2 September 19th 09 01:14 PM
search word or text in excel spreadsheet Louis Excel Discussion (Misc queries) 1 January 18th 08 03:30 PM
Search text field for word GerryK Excel Discussion (Misc queries) 2 September 14th 07 03:42 PM
search for a specific word and copy the word and the preceeding words until a comma DHANANJAY Excel Programming 12 December 31st 05 12:53 PM
trying to search 4 text in a word doc & print page? rede96 Excel Programming 1 April 2nd 04 03:01 PM


All times are GMT +1. The time now is 08:01 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"