PDA

View Full Version : [SOLVED] Beginner: Application.Caller for a shape



ValerieT
05-05-2014, 06:05 AM
Hello

I've got several shapes linked to several actions. I need to identify which shape was activated.

it works fine with the "automatic" name of the shape, but instead I would like to use:

either the more "friendly" name I gave to the shape (in Formula/Name manager)
or the text inside the shape...

I tried with .name or .caption or .text... but can't make it work



Sub View_buttons()

Dim My_Choice As String
My_Choice = Application.Caller

Select Case My_Choice

Case "Rounded Rectangle 4"
....
Case "Rounded Rectangle 5"
...

End Select
End Sub

Paul_Hossler
05-05-2014, 07:35 AM
Try this to return the shape's text



Sub GenericSub()
Dim oCaller As Object

Set oCaller = ActiveSheet.Shapes(Application.Caller)
MsgBox oCaller.TextFrame2.TextRange.Text

End Sub

ValerieT
05-06-2014, 12:36 AM
Fantastic, I've learn something. Thank you so much...