View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default How can I refference then search text in a worksheet text box

Hi Jamie -

Here's a starting point:

Sub jamie()
'Note that you have to activate the worksheet that contains the textbox
'and then select the text box before you can reference its text... this is a
'requirement of the Characters.Text (Method.Property) combination for some
'reason.

Dim boxText As String

Worksheets("Sheet1").Activate
Worksheets("Sheet1").Shapes("Text Box 1").Select ' or .Shapes(1).Select
boxText = Selection.Characters.Text
MsgBox boxText

End Sub
---
Jay

"jseven" wrote:

I have a workbook which contains multiple pages and on each page is a
"notes" section that is simply an Excel text box (created from the
drawing toolbar) and I would like to write a routine that can
refference the text inside of the box. Is there a way to do this?

Let's say its name is "Text Box 1"

I thought there would be something like TextBox1.value, Shapes("Text
Box 1").text etc to refference it, but I can't figure it out. If you
could help me figure out a way to pull the text in the text box into a
variable or refference it somehow I think I'd have it from there.

Thanks so much,
Jamie