View Single Post
 
Old 07-04-2014, 11:22 AM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

I had to look at this a while, but I think I get it, exceere. You didn't specify the name but let's assume it's not "A", "B" or "C"; I'll just pretend it's "Shape_Name" for this. Follow VBA's reasoning:

1) Shapes is a collection.

2) You can refer to a member of a collection either by the member's name (data type string), or by its index (numeric).

3) Application.Caller is neither a string nor a numeric value; it's an object.

When VBA needs a scalar value but is handed an object, it goes to that object's default property. Now, in a range object, the default property is the text value. If that were the default object for a shape, then when you clicked on shape B VBA would have resolved that to ActiveSheet.Shapes("B"), and given you an error because there is no shape named "B". So I suppose the default property of a shape is its name. All three shapes have the same name, "Shape_Name". So I think VBA is resolving it to ActiveSheet.Shames("Shape_Name"), and picking one at random.

Truthfully I don't think much of this theory, but without looking at your actual workbook it's the best I've got right now. If it's right, you'll either have to think of some way to give each shape a different name after all, or just refer to them by number. Can you post your workbook? Maybe something else will become clear.
Reply With Quote