Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 109,157 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,060 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



How to delete pictures from Excel spread sheet?

 
Reply to this topicStart new topic

How to delete pictures from Excel spread sheet?, I'm a beginner and don't know how to do it!

salserompls
post 2 Jul, 2008 - 11:18 AM
Post #1


New D.I.C Head

*
Joined: 2 Jul, 2008
Posts: 1



I need to delete all pictures from an Excel spread sheet. I know hardly any VBA. So far, I have found this code as I have been searching on the internet for help...

ActiveSheet.Shapes.SelectAll
Selection.Delete

But just putting this code in the VBA editor and creating a file to run does nothing. I just get an error that says: COMPILE ERROR: INVALID OUTSIDE PROCEDURE

Can someone please show me what other code I need to make this work? Or maybe I also need to recreate the macro in a different way. I am using the 2003 version of Excel.

Thank you!

User is offlineProfile CardPM

Go to the top of the page


AdamSpeight2008
post 2 Jul, 2008 - 11:36 AM
Post #2


D.I.C Addict

Group Icon
Joined: 29 May, 2008
Posts: 506



Thanked 34 times

Dream Kudos: 1900
My Contributions


QUOTE(salserompls @ 2 Jul, 2008 - 07:18 PM) *



I need to delete all pictures from an Excel spread sheet. I know hardly any VBA. So far, I have found this code as I have been searching on the internet for help...

ActiveSheet.Shapes.SelectAll
Selection.Delete

But just putting this code in the VBA editor and creating a file to run does nothing. I just get an error that says: COMPILE ERROR: INVALID OUTSIDE PROCEDURE

Can someone please show me what other code I need to make this work? Or maybe I also need to recreate the macro in a different way. I am using the 2003 version of Excel.

Thank you!



I'll give you the basic steps to get you started.

Tools->Customize-> Tick Control Toolbox -> Attach -> close

This will add the Control Toolbox to the collection of toolbox, within this tool box find the "Button Control".
Double Right Click on it. Go back the spreadsheet -> Press & Hold the right button & drag diagonally release the button.
Now you should have control on over the spreadsheet with "CommandButton1" on it.
Double right click on the control this will open the VBA code editor of EXCEL. Insert the code inside the subroutine and run again.

Now you can use the button.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/5/08 05:26PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month