views:

19

answers:

1

In Excel I have attached a picture to a cell using the following

Sub InsertPic()
    Dim mPic As Picture
    With ActiveSheet.Range("D12")
         Set mPic = .Parent.Pictures.Insert("C:\abc.png")
         mPic.Top = .Top
         mPic.Left = .Left
         mPic.Placement = xlMoveAndSize
     End With
 End Sub

Excel doesn't allow inserting pictures into cells but places it on it or attaches to it.

At run-time I need to find which Cell the picture is associated to, is this possible?

+2  A: 

Use the .TopLeftCell property.

GSerg
Debug.Print mPic.TopLeftCell.Address worked gives address of cell
Kevin Boyd