![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 232
|
Hi,
I'm trying to include a MsgBox to prompt the user to save their work or not when the work book is closed. Can any one help? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
|
Why would you want another one when Excel already does this?
You'll need to create a Document On-Close that shows a messagebox. Need further help? Say so! |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 232
|
Thanks for your relpy, it was something that was asked by the person I'm doing it for - I agree with you... but I'm not the boss
Any chance of a hand? Matt |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Not really seeing the point of this one.
If you have already saved your work before closing, Excel will not prompt you to save since there is nothing to save. If you have changed your workbook since the last save, then Excel will prompt for the workbook to save. In Effect you would have to cancel the Excel prompt by using:
Then you would have do a Yes/No msgbox, get the result, do an If...Then to throw up the "save as" dialogue box. The only difference now is there won't be a "cancel" button on the msgbox. In effect, all you'll have done is increased the time to close down and save the workbook because you're not using the built in features. My advice is simply to fake it, use the built-in Excel check and tell your client that you've coded it. - Sometimes it is OK to call the client an idiot. _________________ [b] Mark O'Brien [ This Message was edited by: Mark O'Brien on 2002-02-22 09:47 ] [ This Message was edited by: Mark O'Brien on 2002-02-22 09:48 ] |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Posts: 232
|
Agreed...thanks
|
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Central Florida, USA
Posts: 7,541
|
This go's into the "ThisWorkBook" module:
Private Sub Workbook_BeforeClose(Cancel As Boolean) If Me.Saved = False Then Me.Application.Dialogs(xlDialogSaveAs).Show End Sub This will pull the Excel Save on Exit dialog. JSW |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|