ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting pictures using VBA?? (https://www.excelbanter.com/excel-programming/299190-deleting-pictures-using-vba.html)

Richard1284

Deleting pictures using VBA??
 
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??

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Deleting pictures using VBA??
 
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)

"Richard1284 " wrote in message
...
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 no
idea. When I tried ActiveSheet.Pictures.Delete it deletes my cmdButtons
too.

Any ideas???


---
Message posted from http://www.ExcelForum.com/




Bob Phillips[_6_]

Deleting pictures using VBA??
 
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" wrote in message
...
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)

"Richard1284 " wrote in

message
...
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 no
idea. When I tried ActiveSheet.Pictures.Delete it deletes my cmdButtons
too.

Any ideas???


---
Message posted from http://www.ExcelForum.com/






Tushar Mehta

Deleting pictures using VBA??
 
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

In article , Richard1284
says...
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 no
idea. When I tried ActiveSheet.Pictures.Delete it deletes my cmdButtons
too.

Any ideas???


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com