How to retrieve the name of a picture within a worksheet?

  • Thread starter Thread starter Oscar
  • Start date Start date
O

Oscar

How can I find out or edit the object name of a picture that I have added as
a picture file on a worksheet ?

Oscar
 
Depends on what the picture is. If it is a picture object (if you did
insert=>Picture => from file it would be)


Activesheet.Pictures(1).Name
 
Hi Oscar,
Only I know is looping...


Code
-------------------

Const msoPicture As Long = 13
Dim obj As Object
For Each obj In ActiveSheet.Shapes
If obj.Type = msoPicture Then
MsgBox obj.Name
End If
Next
 
This is looping to find the cell at a specific location:
Dave Peterson, posted in programming, 2002-06-16
http://google.com/[email protected]
Sub testme3()
Dim myCell As Range, myShape As Shape
Set myCell = Range("A1")
For Each myShape In ActiveSheet.Shapes
If Intersect(myShape.TopLeftCell, myCell) Is Nothing Then
'do nothing
Else
MsgBox myShape.Name
Exit For
End If
Next myShape
End Sub

Some other possibilities such as name of shapes in a selection,
and additonal information on Shapes can be found in
http://www.mvps.org/dmcritchie/excel/shapes.htm
--
 
Back
Top