Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When you insert the PDF, you can give it a unique name. Then you will know
exactly which object to select for deletion every time. Example: ActiveSheet.OLEObjects.Add(Filename:= _ "C:\documents\temp.pdf", Link:= _ False, DisplayAsIcon:=False).Select Selection.Name = "My_PDF_File" and later on... ActiveSheet.Shapes("My_PDF_File").Select Selection.Delete HTH, Eric "JoeP" wrote: 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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't delete object! | Excel Discussion (Misc queries) | |||
Delete all object | Excel Programming | |||
delete group not object | Excel Programming | |||
delete OLE object | Excel Programming | |||
Cannot delete object | Excel Discussion (Misc queries) |