Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim MyResponse As WorksheetFunction
If Range("F31") = "" Then
Range("F31").Select
Response = MsgBox(Prompt:="Did you leave this blank
intentionally?", Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="; BLANK?;
")
ElseIf Range("D32") = "" Then
Range("D32").Select
Response = MsgBox(Prompt:="Did you leave this blank
intentionally?", Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="; BLANK?;
")
ElseIf Range("C33") = "" Then
Range("C33").Select
Response = MsgBox(Prompt:="Did you leave this blank
intentionally?", Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="; BLANK?;
")
If Response = vbNo Then
Exit Sub
End If
End If
End Sub
2.5 questions:
1. vbYes works fine... I want to cancel print job (return to edit) if
response is vbNo.
2. Instead of 3 message boxes (one for each range checked), can I use one
message box? If Yes how?
Thanks
Lou
Bill Schanks - 30 Jan 2006 23:14 GMT
To get the print to be canceled, you need:
Cancel = True
In the code.
As far as 1 Message box, you would do something like:
If Range("F31") = "" or Range("D32") = "" or Range("C33") = "" Then
'Display MsgBox and any other things that need to be done
Endif
Rookie 1st class - 31 Jan 2006 22:52 GMT
I swear on a stack of UCMJs I tried that minus the "Cancel = True" and got an
error if all three ranges had values; it is working now...
Thanks Bill
Lou
I am using Excel 97 upgraded from Excel 95 and program help is spotty at
best. I keep hoping the computer Gods will smile and I'll get a new system
but the other things more important Gods keep slipping my priority. Any
suggested sources of assistance would be appreciated.
> To get the print to be canceled, you need:
>
[quoted text clipped - 7 lines]
> 'Display MsgBox and any other things that need to be done
> Endif