LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Add-in Error "Application-defined or Object-Defined Error"

Here's the basic premise:

I created a workbook with a userform and openworkbook macros to load
the userform. I then wrote an add-in that simply opened up my workbook
from the tools menu. I forced a saveas so that users couldn't access
the original. If they canceled the saveas or userform then the
userform and my workbook (thisworkbook) would close.

If I open my workbook independently then everything works ok. When I
run the add-in and cancel the saveas or the userform I get a
"Application-Defined or Object-Defined Error". I've tried using "on
error resume next", but the error message still pops up. Although, the
workbook and userform do close, I still don't want the error message
to appear.

Any help would be appreciated.

Here is the code I'm using to close the userform and workbooks. Both
ways to close give the same error.

Is it the use of ThisWorkbook?

Thanks


Private Sub Cancel_Click()
CloseWorkbook = True
On Error Resume Next
ThisWorkbook.Close False
On Error Resume Next
Unload AutoComplete
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseWorkbook = False Then Exit Sub
'skips if OK button is pressed on Userform

Application.DisplayAlerts = False
On Error Resume Next
ThisWorkbook.Close False
Application.DisplayAlerts = True
CloseWorkbook = True
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
1004 "Application-defined or object-defined error" guiu Excel Programming 6 January 12th 06 02:43 PM
Macro Run-time Error 1004 Application Defined or Object Defined Error Anddmx Excel Programming 6 June 9th 04 03:40 PM
What does "Application-defined or object-defined error" mean? Shatin Excel Programming 4 February 3rd 04 10:15 AM
"Application-defined or object-defined error" while printing excel report chemburkar Excel Programming 0 February 2nd 04 08:33 PM
"Run Time Error 1004 Application Defined or Object Defined Error." BJC Excel Programming 4 October 26th 03 03:09 AM


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"