LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Don't let user close. Use macro button to close?

Yeah I'll just delete the button and stick with this method.

Thanks.

Jim Thomlinson wrote:
How about in the before close event add in the save. Add this code to the
ThisWorkbook module (right click the XL icon next to the word file in Excel
and select View Code)

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not ThisWorkbook.Saved Then ThisWorkbook.Save
End Sub

--
HTH...

Jim Thomlinson


"mike" wrote:

How can I force this? Can I?

I need to make sure the workbook is saved before it's closed, make sure
it's not closed without being saved. I have a "Close" button that goes
to a macro that saves.

I thought of putting a save macro in as workbook.deactivate code, but
then my button would be redundant.

Should I just lose the button and stick with workbook.deactivate?



 
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
Ability to close a worksheet and email using a macro button Briant Excel Discussion (Misc queries) 1 November 29th 07 09:49 PM
Macro to Prompt User to Close After Saving Rutabaga Excel Discussion (Misc queries) 2 July 12th 07 12:38 AM
Close user form when button is pressed april27 Excel Programming 1 June 16th 06 11:03 AM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
excel - Windows close button (x) should only close active workboo. CoffeeAdict Setting up and Configuration of Excel 3 February 8th 05 04:30 AM


All times are GMT +1. The time now is 12:15 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"