Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default verifying an object exists

I have a macro with two rectangles that I use as
pushbuttons on a worksheet. Each one has a unique macro
assigned to it.

Macro # 2 makes a copy of the activeworkbook and deletes
the rectangle assigned to Macro # 2 (on the saved copy).
I don't want users to have the option of making another
copy from the "saved" copy.

No problem, so far. However when I open the "saved" copy,
Macro # 1 is used to make a copy of the data and send as
an e-mail attachment. It also deletes the 2 rectangles.

However, if I try to run Macro # 1 (from the "saved" copy,
I get an error because it is trying to delete the second
rectangle (which has already been deleted when the
workbook is copied.)

If Macro # 1 is run from the original workbook, no problem
because both rectangles still exist.

Any suggestions on code to verify the existance of
rectangle 2 would be appreciated.

As always, thanks for the help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default verifying an object exists

You could just wrap the delete command in an on error resume next.

On Error Resume Next
'delete the shape
On Error Goto 0

Robin Hammond
www.enhanceddatasystems.com

"JT" wrote in message
...
I have a macro with two rectangles that I use as
pushbuttons on a worksheet. Each one has a unique macro
assigned to it.

Macro # 2 makes a copy of the activeworkbook and deletes
the rectangle assigned to Macro # 2 (on the saved copy).
I don't want users to have the option of making another
copy from the "saved" copy.

No problem, so far. However when I open the "saved" copy,
Macro # 1 is used to make a copy of the data and send as
an e-mail attachment. It also deletes the 2 rectangles.

However, if I try to run Macro # 1 (from the "saved" copy,
I get an error because it is trying to delete the second
rectangle (which has already been deleted when the
workbook is copied.)

If Macro # 1 is run from the original workbook, no problem
because both rectangles still exist.

Any suggestions on code to verify the existance of
rectangle 2 would be appreciated.

As always, thanks for the help.



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
Look up a value from a row after verifying two other values Paul W Excel Worksheet Functions 11 September 1st 08 08:59 PM
Verifying Dates gilbert Excel Worksheet Functions 1 September 8th 05 03:22 AM
Checking to see if a Range Object exists? debartsa Excel Programming 2 January 20th 04 06:13 PM
Way to prevent VLOOKUP from verifying remote file exists? Mike Frederick Excel Programming 1 December 6th 03 04:14 PM
verifying date MacroMan Excel Programming 0 July 30th 03 10:38 PM


All times are GMT +1. The time now is 06:47 PM.

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

About Us

"It's about Microsoft Excel"