-
Prevent close except...
Thanks, I was looking for a workaround from preventing closing if it is me. I have changed gears and am just using a warning now instead of preventing the closing but still interested if someone has an answer.
You must fill in the data or the workbook will not close. - how do I write an exception in?
-
One way to do this is to ask the question as you close by changing the message box in the original:
orginal:
[VBA]If AllowClose Then
Else
MsgBox Prompt, vbCritical, "Incomplete Data"
Cancel = True
Rng2.Select
End If[/VBA]
change this to:
[VBA]Dim ans As Integer
If allowclose Then
Else
ans = MsgBox("Incomplete data, do you want to close", vbYesNo)
If (ans = vbNo) Then
Cancel = True
End If
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules