How can I refference then search text in a worksheet text box

  • Thread starter Thread starter jseven
  • Start date Start date
J

jseven

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top