Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Don't save before close event?

I'm working on an add-in that will have a user form. I'd like the form to
save its input between shows of it. Apparently the only way to save the
input is in cells on a spreadsheet. That's okay, but I don't want the user
to be asked if they want to save when closing the add-in. What event do I
call so that it exits without asking to save?

Don <donwiss at panix.com.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default Don't save before close event?

Setting the Saved property of the Workbook to True tells Excel there are in
effect no changes and no need to save the workbook. The prompt will not
appear if you set this to true. (ThisWorkbook.Saved = True) Perhaps it goes
without saying, but I'll say it anyway: You should not carelessly cause a
user's work to be discarded, which could happen if you set this property to
True, but do not save the workbook yourself.

Workbook_BeforeClose event is an event that is raised, as it says, before
closing. You can do clean up in response to this event.

Alternatively, you could save your form data in the registry (using
SaveSetting, GetSetting) or in a file (using something like Open
Environ("APPDATA") & "\MyApp\Settings.csv" for Output as #1: Print #1, data:
Close #1).

Bob

"Don Wiss" wrote in message
...
I'm working on an add-in that will have a user form. I'd like the form to
save its input between shows of it. Apparently the only way to save the
input is in cells on a spreadsheet. That's okay, but I don't want the user
to be asked if they want to save when closing the add-in. What event do I
call so that it exits without asking to save?

Don <donwiss at panix.com.



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
Workbook-Close StopTimer event Stonewall Rubberbow Excel Discussion (Misc queries) 2 January 12th 08 11:06 PM
before close event with condition mohavv Excel Discussion (Misc queries) 4 November 21st 07 03:14 AM
Workbook Close Event Stefano Condotta Excel Programming 1 June 16th 04 10:44 PM
Trapping Excel Close event Bob J[_2_] Excel Programming 3 December 5th 03 11:56 PM
After Close Event? Don Wiss Excel Programming 2 November 19th 03 12:30 AM


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