ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run time error 1004 generated in Excel (Office 2003) (https://www.excelbanter.com/excel-programming/372173-run-time-error-1004-generated-excel-office-2003-a.html)

[email protected]

Run time error 1004 generated in Excel (Office 2003)
 
I have code originally generated in excel (office 97). The code is a
simple maco which runs when shape (which looks like a Button) held on a
worksheet is clicked.

One of the requirements is that the button should be deleted from the
worksheet to stop the code being accidentally re-run. The following
code works in Office '97 but generates a run time error in 2003

If IsAnyShape(wsSrc) = 1 Then
wsSrc.Shapes("ImpPhotoBut").Delete

End If

Where IsAnyShape tests for the existence of a shape
wsSrc is a worksheet variable
ImpPhotoBut is the name given to the shape

Incidentally 'wsSrc.Shapes(1).Delete' delivers the identical error.

Any thoughts on why the error occurs in the later software platform and
/or a workaround for this code.


NickHK[_3_]

Run time error 1004 generated in Excel (Office 2003)
 
The.Delete works for me in XL2K.
What is the IsAnyShape function ?

NickHK


groups.com...
I have code originally generated in excel (office 97). The code is a
simple maco which runs when shape (which looks like a Button) held on a
worksheet is clicked.

One of the requirements is that the button should be deleted from the
worksheet to stop the code being accidentally re-run. The following
code works in Office '97 but generates a run time error in 2003

If IsAnyShape(wsSrc) = 1 Then
wsSrc.Shapes("ImpPhotoBut").Delete

End If

Where IsAnyShape tests for the existence of a shape
wsSrc is a worksheet variable
ImpPhotoBut is the name given to the shape

Incidentally 'wsSrc.Shapes(1).Delete' delivers the identical error.

Any thoughts on why the error occurs in the later software platform and
/or a workaround for this code.





All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com