View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JeffTO JeffTO is offline
external usenet poster
 
Posts: 14
Default Application defined or object defined error - Not Caused by Code

I have done some further testing:

I created a new workbook and put the following code:

Sub MYexit()
ThisWorkbook.Saved = True
ThisWorkbook.Close
End Sub


When I run the macro with other workbooks open or closed there is no
problem

However...

When I create a toolbar with a single button and assign MYExit to the
button - I get the same "Application-defined or object-defined error"
ONLY if other workbooks are open.

So it looks like the problem is being cause by running the macro with
a command button when other workbooks are open - again there is no
code causing this error - so I am not sure how to trap it so I can
avoid the error message being shown.

Any thoughts would be great

Thanks again,

Jeff