View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JoeP JoeP is offline
external usenet poster
 
Posts: 24
Default Macro to delete an Object

In Excel 2003 I have a macro that inserts a pdf file into a spreadsheet. When
I run the macro it inserts the pdf file in and the object is assigned a name
Object 11; the next time I run the macro it inserts the pdf file in and the
object is assigned a name Object 12, and so on. I am fine with that part.

Now I want to record a macro to clear the object from the worksheet. The
problem is that since the object name is changing from Object 11 to Object
12. So when I go to record the macro it will delete the object.

But when I run the macro again to insert the pdf and then try to run the
macro to delete the pdf the macro fails since it cannot find the object that
I want to delete.

I guess the bottom line question is - is there a way to name an object when
inserted into a spreadsheet so that it always named Object 1?

Thanks for any help.