View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Manually changing a picture (shape) name property

The first loop list the old names. The second loop assigns new names:

Sub Macro1()
newname = Array("Alpha", "Beta", "Gamma")
Dim sh As Shape

For Each sh In ActiveSheet.Shapes
MsgBox (sh.Name)
Next

For i = 0 To 2
ActiveSheet.Shapes(i + 1).Name = newname(i)
Next
End Sub
--
Gary''s Student - gsnu2007j


"ker_01" wrote:

I've got several bitmaps pasted on Sheet1 that I need to refer to in VBA.
However, I'm having trouble figuring out which is which. I'd like to name
each with something easy to remember, but when I bring up the properties tab
(even when the picture is selected) it gives me the worksheet properties and
not the picture properties.

I tried cycling through the images with VBA (thinking I could figure out
which was which and assign names through code) but it is telling me there
are more pictures than actually exist on the sheet, which makes me think
that Excel considers the extra pictures I deleted to still be present- which
makes it even harder to figure out which are which.

So, can anyone tell me how to find and change the name property of a
shape/picture?

Thanks!
Keith