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: 14
Default Closing FIle with Command Bar Button Problem

Hi All

I posted this last week with a different title and didnt get any
responses - so perhaps my messages was not understood - so I am trying
again:

I am getting a very strange error which I have isolated but I do not
know how to get rid of:

I have a workbook with the following code:

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


When I run the macro directly from 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 an "Application-defined or object-defined error" ONLY
if other workbooks are open - I do not get this message if there are
no other workbooks 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 - I step through all the code no problem and
this error comes up after all the code runs properly - so I am not
sure how to trap it so I can avoid the error message being shown.


Any thoughts would be great

I really appreciate any ideas on this one

Thanks,

Jeff
 
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
a command button problem NA_AB[_2_] Excel Programming 1 January 9th 09 02:28 PM
Command Button Problem albertmb Excel Discussion (Misc queries) 6 June 22nd 08 01:06 PM
Closing an Excel Spreadsheet via command button [email protected] Excel Programming 1 February 15th 08 04:45 PM
Problem with command button name Jason[_9_] Excel Discussion (Misc queries) 10 October 19th 07 09:54 PM
Command Button Problem del Excel Programming 3 November 21st 03 05:13 PM


All times are GMT +1. The time now is 06:23 AM.

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"