ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I refference then search text in a worksheet text box (https://www.excelbanter.com/excel-programming/400511-how-can-i-refference-then-search-text-worksheet-text-box.html)

jseven

How can I refference then search text in a worksheet text box
 
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


Jay

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




All times are GMT +1. The time now is 07:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com