text in a shape

Jackeb

Board Regular
Joined
Mar 20, 2002
Messages
81
Can anyone help me..??

What is the line of code to retrieve the text in an autoshape?

how do i test this text for a certain word, the word is current..??

Heelllppppp......

cheers

Ed
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
The following code tests the selected autoshape:

TestText = Selection.Characters.Text
If TestText = "current" Then MsgBox "Text is equal to current"
 
Upvote 0
yeah,

I have selected the shape using:

Sub currentbar()
Dim sh As Shape, shtxt As String


For Each sh In ActiveSheet.Shapes

sh.Select
shtxt = Selection.Characters.Text

Debug.Print shtxt

Next

Set sh = Nothing
End Sub

but I cannot get a list of the text in the autoshapes....

I am sure that it is a simple solution!?!?!?!
 
Upvote 0
Try the following:

For Each sh In ActiveSheet.Shapes

sh.Select
On Error Resume Next
shtxt = Selection.Characters.Text

MsgBox shtxt

Next
 
Upvote 0
that is great,

It didn't like the shapes without any text in, that bypassed it...


Merci
 
Upvote 0

Forum statistics

Threads
1,213,526
Messages
6,114,136
Members
448,551
Latest member
Sienna de Souza

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top