Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: text in a shape

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    81
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    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. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The following code tests the selected autoshape:

    TestText = Selection.Characters.Text
    If TestText = "current" Then MsgBox "Text is equal to current"

    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    81
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    for some reason this doesn't seam to work.....

    i am slightly bemused..???

  4. #4
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You have to have the autoshape selected.

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Posts
    81
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #6
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try the following:

    For Each sh In ActiveSheet.Shapes

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

    MsgBox shtxt

    Next

    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  7. #7
    Board Regular
    Join Date
    Mar 2002
    Posts
    81
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    that is great,

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


    Merci

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •