Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Look up a value from a row after verifying two other values | Excel Worksheet Functions | |||
Verifying Dates | Excel Worksheet Functions | |||
Checking to see if a Range Object exists? | Excel Programming | |||
Way to prevent VLOOKUP from verifying remote file exists? | Excel Programming | |||
verifying date | Excel Programming |