Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 17th, 2005, 07:00 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default delete all images from spreadsheet

I am looking for code that will delete all images from spreadsheet.

Just do a search then delete any it finds.

TIA>

Picco

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old May 17th, 2005, 08:38 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

Solution:
Code:
Sub DeleteShapes() 
     '-------------------------------------------------------
          ' Function:    Delete all shapes from a worksheet
     ' Constraints: Don't delete autofilter and Data
     '               Validation arrows
     '-------------------------------------------------------
    Dim shp As Shape 
    Dim testStr As String 
    Dim OkToDelete As Boolean 
     
    For Each shp In ActiveSheet.Shapes 
        OkToDelete = True 
        testStr = "" 
        On Error Resume Next 
        testStr = shp.TopLeftCell.Address 
        On Error Goto 0 
        If shp.Type = msoFormControl Then 
            If shp.FormControlType = xlDropDown Then 
                If testStr = "" Then 
                     'keep it
                    OkToDelete = False 
                End If 
            End If 
        End If 
        If OkToDelete Then 
            shp.Delete 
        End If 
    Next shp 
     
End Sub
www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to delete file System.IO.Delete error maricar C# 13 March 14th, 2014 06:50 AM
php/mysql delete button and delete query dungey PHP Databases 17 April 11th, 2009 12:24 PM
Load Images from and Save Images to a Database cyndie VB.NET 2 August 17th, 2008 06:42 AM
Excel Spreadsheet Help SteveV VBScript 0 October 10th, 2006 04:42 PM
how to delete a row when click delete hyperlink naveenkumarg1 Pro JSP 1 August 16th, 2004 01:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.