Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing Graphics in Excel 1

Status
Not open for further replies.

davefish

Technical User
Jul 26, 2002
169
GB
I have successfuly placed a number of graphics by coordinates on an spreadsheet but am having a problem deleting them with a macro. The Gif files are called up from a specific path and loaded into an array as can be seen below, but as these are generated each time I launch the application they attract a 'new' increment number. Is there anyway I can call these without refering to the picture number??

Sub Clear_Graphics()

ActiveSheet.Shapes.Range(Array("Picture 224", "Picture 225", "Picture 226")). _
Select
Selection.Delete

End Sub


Regards

DF
 
This will rename all of the pictures on the ActiveSheet. It might help:
Code:
Sub RenamePictures()
Dim pic As Shape, i As Integer
i = 1
For Each pic In ActiveSheet.Shapes
    If pic.Type = 13 Then ' Is Picture
        pic.Name = "Picture" & i
        i = i + 1
    End If
Next pic
End Sub



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
And this will delete ALL of the pictures on the ActiveSheet:
Code:
Sub DeleteALLPictures()
Dim pic As Shape
For Each pic In ActiveSheet.Shapes
    If pic.Type = 13 Then ' Is Picture
        pic.Delete
    End If
Next pic
End Sub

I hope this helps!


Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
As per usual you've come come up with the goods. Many thanks for a speedy response.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top