View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
R Kumana[_2_] R Kumana[_2_] is offline
external usenet poster
 
Posts: 3
Default Automation error?

Hello,

I have an error that comes up at the end of this macro. It says "Run-time
error '-2147221080 (800401a8)': Automation error"

This happens after the workbook "OldScorecard" is closed (see code) and the
worksheet "Updater" is deleted.

I suspect it may have to do with the fact that the code is located on the
Updater worksheet. This is intentional. I want to macro to delete itself (and
the sheet it runs from) once it is run once. I tried it before and had no
issues, so I am not completely sure that this is causing it, but it is
certainly happening after the deletion.

I am also getting a message saying there is a lot of information on the
clipboard (presumably when I close the other workbook). How can I force "No"
on this message?

Thanks for helping!


'================================================= ==============
'Cleanup section
'---------------
'Close old scorecard without saving changes
OldScorecard.Close savechanges:=False


'if we put this sheet on the new scorecard.
'This turns off alerts then deletes the updater sheet
Application.DisplayAlerts = False
NewScorecard.Worksheets("Updater").Delete
Application.DisplayAlerts = True



Exit Sub
'================================================= ==============
'Error handling and message section