Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Application-defined or object-defined error on closing

OK - the deafening silence tells me it was this week's stupid question - how
does the macro finish running if it's last line is "activeworkbook.close",
thus closing the workbook that contains the macro..? Doh!

I re-enabled the "Close" command from the "File" menu instead.

I wear my "Dunce of the Week" hat in shame... :-)

Pete



"Peter Rooney" wrote:

Good morning everyone.

I have a workbook that customises the Excel Menubar. One of the commands
allows the user to open another workbook, and to close the active workbook,
the user selects a command from the customised menu that runs the macro
"CloseMe" as shown below.

ScreenReset is used to reset a number of screen customizations. The MsgBox
shows me if "ScreenReset" has run OK (which it does), but when the workbook
closes, the message "Application-defined or object-defined error on closing"
is displayed.

When I click OK on this message and the workbook (which is called from
another workbook) closes, the Workbook_Activate macro in the calling workbook
(which then becomes the active workbook) doesn't kick in.

Sub CloseMe()
On Error Resume Next
'Application.EnableEvents = False
'Application.DisplayAlerts = False
Application.ScreenUpdating = False
RequestPassword = False
ScreenReset
MsgBox ("Past ScreenReset")
Application.ScreenUpdating = True
ActiveWorkbook.Close
End Sub


Can anyone hazard a guess as to what's going on?

Thanks in advance

Pete


Reply
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
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
Application-Defined or Object-Defined Error on simple code Fid[_2_] Excel Programming 1 July 21st 05 08:30 PM
Application-Defined or Object-Defined Error on simple code [email protected] Excel Programming 6 February 22nd 05 09:03 PM
Application-defined or object-defined error - missing the basics [email protected] Excel Programming 1 December 28th 04 10:23 PM
Macro Run-time Error 1004 Application Defined or Object Defined Error Anddmx Excel Programming 6 June 9th 04 03:40 PM


All times are GMT +1. The time now is 12:56 PM.

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

About Us

"It's about Microsoft Excel"