Deleting pictures using VBA??

  • Thread starter Thread starter Richard1284
  • Start date Start date
R

Richard1284

Hi all,

Can anyone help me, I have inserted a picture
ie.
ActiveSheet.Pictures.Insert("F:\Dss\ass\Arran1.jpg").Select

Now all I want to do is delete it using VBA. Unfortunately I have n
idea. When I tried ActiveSheet.Pictures.Delete it deletes my cmdButton
too.

Any ideas??
 
Hi Richard,

When you open the picture, set a variable to that pic, like so

Dim myPic As Picture
Dim sPic As String

sPic = ("F:\Dss\ass\Arran1.jpg"
Set myPic = ActiveSheet.Pictures.Insert(sPic)

and then you can simply delete it via the variable

myPic.Delete


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
small typo, should be

Dim myPic As Picture
Dim sPic As String

sPic = "F:\Dss\ass\Arran1.jpg"
Set myPic = ActiveSheet.Pictures.Insert(sPic)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Bob Phillips said:
Hi Richard,

When you open the picture, set a variable to that pic, like so

Dim myPic As Picture
Dim sPic As String

sPic = ("F:\Dss\ass\Arran1.jpg"
Set myPic = ActiveSheet.Pictures.Insert(sPic)

and then you can simply delete it via the variable

myPic.Delete


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
For a continuation of this discussion, see the concurrent subject
'Sorry here it is again' in the same newsgroup.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top