Runtime error 1004: method delete of class picture cannot be found

S

SchoutenCC

Hi all,
I've got a problem with the above error message (translated from
localized message). The problem occurs from a VBA macro and I can't
seem to get rid of it. The macro only opens a file, performs some
calculations with a (JetReports) plugin and closes off so that doesn't
involve any pictures or picture-manipulation. The file used to contain
exactly one picture (company logo on top) but the error message stays
even after having deleted the logo.
Does anybody have any suggestions what could be causing this?
PS: error occurs both in excel 2003 and 2007 and also independent from
if the macro is invoked by a commandbutton or through wscript.
Thanks in advance,
Chris
 
B

Bernie Deitrick

Chris,

Are you sure that is the only code? Look into the sheet and workbook codemodules for event code -
the workbook may have code to manipulate the logo whenever something changes on the sheet.

You could also try

Application.EnableEvents = False

at the top of your code, with

Application.EnableEvents = True

at the bottom, to see if that clears things up.

HTH,
Bernie
MS Excel MVP
 
S

SchoutenCC

Dear Bernie,

Are you sure that is the only code? Look into the sheet and workbook codemodules for event code -
the workbook may have code to manipulate the logo whenever something changes on the sheet.

It doesn't as far as i can see... no modules at all in the sheet "to
be manipulated" and only one self-made module in the "macro menu"
sheet.
You could also try
Application.EnableEvents = False
at the top of your code, with
Application.EnableEvents = True
at the bottom, to see if that clears things up.

Thanks for the tip; looking at http://support.microsoft.com/kb/213720
it seems this just temporarily 'deletes' all message boxes/alerts
which may not solve the root problem but definitely cover it up ;)

Best,
Chris
 
B

Bernie Deitrick

it seems this just temporarily 'deletes' all message boxes/alerts
which may not solve the root problem but definitely cover it up ;)

You're thinking of Application.DisplayAlerts. EnableEvents = False will prevent any code in the
Thisworkbook or worksheet codemodules from running. If it 'fixes' the problem, it means that you
have code that manipulates the logo, and need to find and delete it.

Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top