![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 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
__________________
Ed Jackson "Do not worry about your problems with mathematics, I assure you mine are far greater." A. Einstien |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
The following code tests the selected autoshape:
TestText = Selection.Characters.Text If TestText = "current" Then MsgBox "Text is equal to current"
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 81
|
for some reason this doesn't seam to work.....
i am slightly bemused..??? |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
You have to have the autoshape selected.
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Posts: 81
|
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!?!?!?! |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try the following:
For Each sh In ActiveSheet.Shapes sh.Select On Error Resume Next shtxt = Selection.Characters.Text MsgBox shtxt Next
__________________
Kind regards, Al Chara |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Posts: 81
|
that is great,
It didn't like the shapes without any text in, that bypassed it... Merci |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|