Dear Shawn:
There are some things you need to address:
Try something like the following:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Daily Log of Students Seen").Range("C40").Value <
Worksheets("Daily Log of Students Seen").Range("W40").Value Then
' Changes:
Msg = "You have forgot to appropriately record your time! Do you
want to close?"
if MsgBox(Msg, vbYesNo OR vbExclamation, "Please add your time in
or time out") = vbNo Then
'Cancel close
Cancel=true
End if
End If
End Sub
Hope that helps; if it does, please rate my post.
"Shawn" wrote:
The code below checks out something for me once the user decides to close the
program. It gives a pop up box if appropriate.
Here is my code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Daily Log of Students Seen").Range("C40").Value <
Worksheets("Daily Log of Students Seen").Range("W40").Value Then
Msg = "You have forgot to appropriately record your time!"
Ans = MsgBox(Msg, vbOKOnly + vbExclamation, "Please add your time in
or time out")
End If
End Sub
I want to add an If Then statement that if they select VB OK then the
program won't close. How do I prevent the program from closing?
--
Thanks
Shawn