Warning message when closing

J

Joeg

Is there a way to customize the alert message when you close a workbook
We need a customize a message that will promt the user to revise
number instead of just asking if you want to save changes.:confused
 
O

Otto Moehrbach

Joeg
You can't customize that message. But you can use the Before-Close
event macro to do the following:
Cancel the close command.
Check if the number (your number) has been revised.
If it has, save and close.
If it hasn't, request that the user revise that number before closing the
file.
Post back if you think this will do what you want. Also provide more
detail on what you mean by "revise a number". HTH Otto
 
J

Joeg

Otto
There is a way to customize the close message. I did a search an
found this user who wanted a custom msgbox if the worksheet hadn't bee
protected. A user replied that using the workbook_beforeClose event.
They used the following:
if worksheets("Sheet1").ProtectContents = False then
msgbox "Protect sheet"
cancel = true
End if
I checked this out and it works but I don't want it to check fo
protection. We have a workbook that contains parts that are bein
changed more than once daily. The owner wants a way to be notified t
remember to change the revision number of the workbook after eac
change. If you have any ideas I would greatly appreciate them
Joe
 
J

John Thow

Otto
There is a way to customize the close message. I did a search and
found this user who wanted a custom msgbox if the worksheet hadn't been
protected. A user replied that using the workbook_beforeClose event.
They used the following:
if worksheets("Sheet1").ProtectContents = False then
msgbox "Protect sheet"
cancel = true
End if
I checked this out and it works but I don't want it to check for
protection. We have a workbook that contains parts that are being
changed more than once daily. The owner wants a way to be notified to
remember to change the revision number of the workbook after each
change. If you have any ideas I would greatly appreciate them
Joeg

An Open event to check the value of the revision number, a Calculate event to
note that a sheet has been changed and a BeforeClose event to update the
revision number?
--
John Thow
an optimist is a guy/ that has never had/ much experience -
certain maxims of archie; Don Marquis.

To e-mail me, replace the DOTs in the Reply-To: address with dots!
 
O

Otto Moehrbach

Joeg
That isn't a revision of the 'save before close' warning. That's just a
message box that the code displays saying whatever you want to say at that
time. I don't know the details of your "revised" requirement but the macro
you need would look like this:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If 'whatever you want to see to allow a close is there' Then _
Exit Sub
Cancel = True
MsgBox "You must do such and such before closing this file"
End Sub

Come back with more details if you need more help with this. HTH Otto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top