![]() |
How do I delete an embedded picture on a worksheet using VBA?
My VBA routine copies an embedded chart from a worksheet to another worksheet
as a picture (CopyPicture). This works fine but I want to clear the picture from the destination worksheet before copying anouther picture to it, so the pictures don't build up. I can't seem to find a way to activate the picture via VBA so that it can be deleted. |
How do I delete an embedded picture on a worksheet using VBA?
hi GTJames
See http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "GTJames" wrote in message ... My VBA routine copies an embedded chart from a worksheet to another worksheet as a picture (CopyPicture). This works fine but I want to clear the picture from the destination worksheet before copying anouther picture to it, so the pictures don't build up. I can't seem to find a way to activate the picture via VBA so that it can be deleted. |
How do I delete an embedded picture on a worksheet using VBA?
Try something like the following:
Dim ChtObj As ChartObject Dim Pict As Picture Set ChtObj = Worksheets(1).ChartObjects(1) ChtObj.CopyPicture xlScreen On Error Resume Next Worksheets("sheet2").Pictures(1).Delete On Error GoTo 0 Worksheets("Sheet2").Paste -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "GTJames" wrote in message ... My VBA routine copies an embedded chart from a worksheet to another worksheet as a picture (CopyPicture). This works fine but I want to clear the picture from the destination worksheet before copying anouther picture to it, so the pictures don't build up. I can't seem to find a way to activate the picture via VBA so that it can be deleted. |
How do I delete an embedded picture on a worksheet using VBA?
does this help?
Sub findPicturename() msn = "Picture " & ActiveSheet.Shapes.Count MsgBox msn ActiveSheet.Shapes(msn).Cut 'Select End Sub -- Don Guillett SalesAid Software "GTJames" wrote in message ... My VBA routine copies an embedded chart from a worksheet to another worksheet as a picture (CopyPicture). This works fine but I want to clear the picture from the destination worksheet before copying anouther picture to it, so the pictures don't build up. I can't seem to find a way to activate the picture via VBA so that it can be deleted. |
All times are GMT +1. The time now is 06:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com