excel >> Delete All Picture Objects Using VBA

by Nathan Bell » Tue, 12 Apr 2005 22:23:57 GMT

All,

I am looking for some code that will allow me to go in and delete all
"Picture" objects from within a worksheet without deleting the rest of the
data. Is this possible?

Regards,

Nathan



excel >> Delete All Picture Objects Using VBA

by Don Guillett » Tue, 12 Apr 2005 22:43:29 GMT


various ways

Sub ShapesCut()
For Each S In ActiveSheet.Shapes
S.Cut
Next
End Sub
'or

Sub shapescut1() 'Tom Ogilvy
ActiveSheet.Shapes.SelectAll
Selection.Delete
End Sub

Sub ShapesALLinWorkbookDelete() 'Deletes all in WORKBOOK
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
sh.DrawingObjects.Delete
Next sh
end sub
--
Don Guillett
SalesAid Software
XXXX@XXXXX.COM

excel >> Delete All Picture Objects Using VBA

by Bernie Deitrick » Wed, 13 Apr 2005 01:50:33 GMT

Nathan,

ActiveSheet.DrawingObjects.Delete

Or simply use Edit | Go To... Objects, press OK, then Delete.

HTH,
Bernie
MS Excel MVP

excel >> Delete All Picture Objects Using VBA

by Debra Dalgleish » Wed, 13 Apr 2005 03:00:48 GMT

If you want to delete only Pictures, but not other shapes, such as text
boxes, you can use code similar to the following:

'======================
Sub DeletePictures()
Dim shp As Shape
For Each shp In ActiveSheet.ShapeRange
If shp.Type = msoPicture Then
shp.Delete
End If
Next shp
End Sub
'=====================




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

Similar Threads

1. Deleting pictures using VBA?? - Excel

2. deleting objects using VBA

3. How can I delete a picture object ? - Visual Basic/VB

4. Deleting Objects Using VBA

hi to everybody,

I do have a problem administering my BE/FE Application (Windows 2000 
Professional, Access 2000): When closing my application, I would like to 
delete quite a number of various objects (such as tables, queries, forms, 
reports, modules) - most of them embedded or imported, some created. Which 
objects are to be deleted is defined in a table called "basImport" containing 
all information which way an object should be treated (Sometimes this even 
varies from user to user).

I am trying to do this by a separate For ... Each Routine for each Group of 
Objects, in which name after name is defined and subsequently the object (e. 
g. a Form) is deleted by "DoCmd.DeleteObject acForm, obj.Name".

However, not all Forms (same applies for some Reports and som Tables) are 
deleted allthough they should be. Running the procedure step by step it runs 
correctly through the For ... Each Routine but in some cases (the last ones, 
whereever they may start) the obj.Name cannot properly defined (It states 
something like "Object Variable not properly defined or does not exist". As 
the procedure includes an Error-Routine it slips just over te problem and 
leaves the object unremoved.

Do I have to refresh the e. g. Forms-Listing after each deletion and how can 
I do this ?

                      Is there anybody out there ?

who could help me?

Many thanks in advance !

Ulrich

5. PowerPoint VBA - Picture Object, OLE Object file extension, type, or format

6. Delete Picture Objects

How can I select all the picture objects in my excel file and delete them? 
I've tried highlighting the column but that doesn't work.

Thanks Mike 


7. Deleting a toolbar button just deletes the icon image, using VBA in word XP

8. Vba - Picture Object naming

Hi,

I have a macro that copy's a range in the workbook to a picture.

1.) Copy's a range and saves as a picture

What I want to do - rename the picture object.  I think it is named "Picture 
1" or "Picture X" by default, but this is no good since I want to refer to it 
later in the code.

Code:
Sub Create_picture()
'Create the picture
Worksheets("Pol Value").Range("A1:J50").CopyPicture xlScreen, xlBitmap

End sub

Thanks for your help