Trigger macro to run when picture is deleted

  • Thread starter Thread starter David Cuthill
  • Start date Start date
D

David Cuthill

I need to find a way to have a macro run when a picture on
a worksheet is deleted. The pictures are loaded into the
worksheet using a macro - when the picture is loaded
descriptive text in a cell is added to the worksheet that
corresponds to the picture. If a picture is loaded
accidentally the user has the option of clicking on the
picture and hitting the delete key - the problem is the
corresponding text remains. How can I get a macro to run
each time a picture is deleted that will delete the
picture description???

I have searched past threads but can't seem to get
something that is similar.


David
 
Another option I was considering was to somehow link the
range value with the picture when it is loaded so that if
the picture is deleted the range is also deleted but I'm
not sure if this is possible.

David
 
Hi David,

You could use OnKey to reassign the Delete key to a macro something like this,

Sub MyDeleteKey()
If TypeName(Selection) = "Picture" Then
'Special Delete
Else
Selection.Delete
End If
End Sub

Beware this is just air-code, and you'll need to do better than just
Selection.Delete. Not all types of selections will have a delete method.


Regards,
Vic Eldridge
 
Back
Top