Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Excel Shapes

Is there a way reference a excel shape with a macro attached to it when you
have clicked onto it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Excel Shapes

Option Explicit
Sub testme()

Dim myShp As Shape

Set myShp = ActiveSheet.Shapes(Application.Caller)

With myShp
MsgBox .Name & vbLf & .TopLeftCell.Address & vbLf & .Name
End With

End Sub

Jason Zischke wrote:

Is there a way reference a excel shape with a macro attached to it when you
have clicked onto it?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default Excel Shapes

Some additional macros working with Shapes, but not
from a macro attached to the shape, like you asked and
Dave answered, but you might find
something you want to add to Dave's example.
http://www.mvps.org/dmcritchie/excel/shapes.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Excel Shapes

Jason,

Application.Caller will return a text string with the name of the
shape. Thus, you can get a reference through the Shapes
collection. E.g.,

MsgBox ActiveSheet.Shapes(Application.Caller).Name


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jason Zischke" wrote in
message
...
Is there a way reference a excel shape with a macro attached to
it when you
have clicked onto it?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Excel Shapes

Yes
Right click on the excel shape, select Attach Macro. Assign the
corresponding macro. When you move the mouse over the shape a hand will
appear. Click to run the attached macro.

"Jason Zischke" wrote:

Is there a way reference a excel shape with a macro attached to it when you
have clicked onto it?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel document with shapes on it but the shapes do not print [email protected] Excel Worksheet Functions 2 October 22nd 09 06:17 PM
Naming Auto Shapes and Creating new Shapes AL2000 Excel Discussion (Misc queries) 3 September 10th 07 04:12 AM
When drawing shapes in excel the shapes keep disappearing Tape Excel Discussion (Misc queries) 1 October 6th 06 04:23 PM
How can i get more 3D shapes for Auto shapes in excel? Ajey Excel Discussion (Misc queries) 0 March 3rd 05 09:53 AM
How can i get more 3D shapes for Auto shapes in excel? Ajey Excel Discussion (Misc queries) 0 March 3rd 05 09:53 AM


All times are GMT +1. The time now is 06:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"