Warning message before closing Excel
Solved
DBD
-
ancat -
ancat -
Good evening,
I would like Excel (version 1997-2003) to prompt me before exiting by clicking the cross, asking if I have properly entered the date and the name of the person responsible for updating the file on the home sheet.
Message box: "Have you entered your name and the date of the last update on the home sheet? Thank you."
Thank you very much.
I would like Excel (version 1997-2003) to prompt me before exiting by clicking the cross, asking if I have properly entered the date and the name of the person responsible for updating the file on the home sheet.
Message box: "Have you entered your name and the date of the last update on the home sheet? Thank you."
Thank you very much.
Configuration: Windows XP Internet Explorer 6.0
3 answers
-
Hello,
You open your Visual Basic Editor, either through the visual basic bar or by right-clicking on a sheet tab in the VBAProject, you will find ThisWorkbook, you paste the code below
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Msg = "Have you entered" & vbCrLf & "" & vbCrLf & " your name and the date of the last update on the home sheet thank you"
StyleBoîteDialogue = vbOKOnly + vbQuestion
Title = "Before closing this file,"
response = MsgBox(Msg, StyleBoîteDialogue, Title)
End Sub
We'll talk about it tomorrow
See you later-
-
Good evening and thank you very much Mike-31!
You solved the problem for me and it’s perfect!
I have a small question, although I don't want to take advantage, could you explain the role of the following characters that you included in the macro?
"& vbCrLf & "" & vbCrLf &"
Thank you
very much and see you soon...
Dan.
-
-
Yes, there are books, but to advise you, I'm a bit overwhelmed. To start, go to a large store or FNAC and select books based on your current knowledge in order to understand the more technical codes and not get lost.
Then be curious, sign up for a forum and follow various conversations at your level and practice on your PC.
One piece of advice: don't try to rush things, Excel has a monstrous amount of possibilities.
Good luck, see you! -
Hi,
this is the code to create an additional line in your msgbox to avoid having overly large msgboxes and to facilitate reading
below your text is on three lines
Msg = "Have you written" & vbCrLf & "" & vbCrLf & " your name and the date of the last update
below your text is on two lines
Msg = "Have you written" & vbCrLf & " your name and the date of the last update on the home sheet thank you"
below your text is on one line
Msg = "Have you written your name and the date of the last update on the home sheet thank you"
See you later!