Fooling around with "Shapes" and "Selection of shapes"

keldsor

Board Regular
Joined
Jun 9, 2017
Messages
52
I'm just manually trying to move some shapes around on the active worksheet by selecting the shapes AND then with a Sub move them.

IF I in the immidiate window asks for:

? Excel.Selection.Count

I get the correct number back ... tried many different selections

BUT

? Excel.Selection.Item(1).Name

does NOT give me the right name of the first object in the selection ... in fact the shape with that name is not even IN the selection at all !

It looks like it returns the name of the SHAPES instead !

How can I get the names of the shapes in the SELECTION ?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hello,

try it like this (untested)

Code:
sub read_ShapeNames
dim Shp as shape
for each shp in activesheet.shapes
   debug.print shp.name 'also typename(shp) and others
next shp
end sub

regards
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top