Announcement

Collapse
No announcement yet.

Using Shape Names

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using Shape Names

    I need to access and use the Name of Shapes but cannot work out how. Clicking on a shape is to run a macro and the macro needs to pick up the name of the shape clicked on and then use it.

    The line of code needs to be something like:
    ActiveCell = Sheets("Front").ActiveShape.Name & ": " & "(" & Entry.What & ")" & " " & Entry.Info

    The "Sheets("Front").ActiveShape.Name" is clearly wrong syntax.

    How do I access and use Shape Name?

  • #2
    You will have to use the actual shapes name, eg

    ActiveSheet.Shapes("AutoShape 1").Select
    Hope that Helps

    Roy

    New users should read the Forum Rules before posting

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

    Comment


    • #3
      Thanks RoyUK, but the point is I need to click on the shape to activate the Macro and use the name of the Shape in the macro. There are 60-odd shapes throughout the workbook!

      Comment


      • #4
        Hi Darslg,

        Use the Application.Caller property to return the name of the shape.

        Sub ClickAnyShape()
        MsgBox ActiveSheet.Shapes(Application.Caller).Name & " Clicked"
        End Sub

        Cheers
        Andy

        Cheers
        Andy

        Comment


        • #5
          Working with Andy's code

          ActiveCell.Value = Sheets("Front").Shapes(Application.Caller).Name& ": " & "(" & Entry.What & ")" & " " & Entry.Info
          Hope that Helps

          Roy

          New users should read the Forum Rules before posting

          For free Excel tools & articles visit my web site

          If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

          RoyUK's Web Site

          royUK's Database Form

          Where to paste code from the Forum

          About me.

          Comment

          Working...
          X