ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting a Drawing Object (https://www.excelbanter.com/excel-programming/438595-selecting-drawing-object.html)

Troubled User

Selecting a Drawing Object
 
I need to get the name of a drawing object when I click it via a left click,
something like:

Sub TheDrawingObject

msgbox(me.name)

End Sub

I need to assign it to a variable. Any help would be greatly appreciated.


Dave Peterson

Selecting a Drawing Object
 
Option Explicit
Sub TheDrawingObject()
Dim myShape as shape
set myshape = activesheet.shapes(application.caller)

'just to show a few ways to get it and other options
msgbox application.caller _
& vblf & myshape.name _
& vblf & myshape.topleftcell.address

End sub

Troubled User wrote:

I need to get the name of a drawing object when I click it via a left click,
something like:

Sub TheDrawingObject

msgbox(me.name)

End Sub

I need to assign it to a variable. Any help would be greatly appreciated.


--

Dave Peterson


All times are GMT +1. The time now is 07:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com