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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Excel Shapes

Status
Not open for further replies.

Rocks

Programmer
Jul 17, 2001
4
0
0
US
Hi all,

I have a quick question in VBA (Excel) I am adding a shape to the ActiveSheet by using:

ActiveSheet.Shapes.AddPicture cFile, True, True, 66, 665, 259, 175

This all works fine, but what I need to to is reselect this shape and delete it.

Does any one know how I can do this. I was thinking about using the .Shapes.SelectAll method but thier maybe more then one shape in the worksheet and I don't want to delete that one.

Any ideas Views would be great.

Many thanks in advance

 
Hi Rocks,

Try to give your shape a name sot hat you know which shape to delete later on. Something like:

Code:
...
With ActiveSheet.Shapes.AddPicture cFile, True, True, 66, _
                                          665, 259, 175
    .Name="NameOfShapeToDeleteLaterOn"
End With
...

'code to actually delete the shape:
Activesheet.Shapes("NameOfShapeToDeleteLaterOn").Delete
...
[\code]

I didn't actually try the code so it might need some adjustments btu I think it is what you need.

Nath
 
Many thanks for your help!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top