Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Does an object exist?

I need to find an object (in this case, a picture) on a worksheet, and if it
exists, delete it. I will know ahead of time the name of the object, but how
can I avoid an error message by trying to delete it if it's not there?






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Does an object exist?

Hi Paul

One way is to use On Error Resume Next


On Error Resume Next
ActiveSheet.Shapes("yourshapename").Delete
On Error GoTo 0


More info here
http://www.rondebruin.nl/controlsobjectsworksheet.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Paul Pedersen" wrote in message ...
I need to find an object (in this case, a picture) on a worksheet, and if it
exists, delete it. I will know ahead of time the name of the object, but how
can I avoid an error message by trying to delete it if it's not there?






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Does an object exist?

I think I found the answer. Is "On Error Resume Next" the best way to handle
it?


"Paul Pedersen" wrote in message
...
I need to find an object (in this case, a picture) on a worksheet, and if
it exists, delete it. I will know ahead of time the name of the object, but
how can I avoid an error message by trying to delete it if it's not there?








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object does not exist. Jerry McNabb Excel Discussion (Misc queries) 4 February 8th 08 08:01 PM
How to, check if a picture object exist Kevin McCartney Excel Programming 7 May 24th 06 08:53 PM
How to test if an object exist really Jean-Pierre Bidon Excel Programming 3 April 18th 06 02:24 PM
Command Line. How to tell to XL : If the xls file exist : Open it, if it does not exist : Create it. Tintin92 Excel Programming 3 March 11th 06 06:45 PM


All times are GMT +1. The time now is 03:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"