Msgbox Close with vba
You all guys are great, but nobody answered my question. I'll explain why I
need it. The code that triggers the msgbox is "beforePrint" event. Now the
msgbox is also triggered when Print Preview is pressed. So I have a activex
command button that opens the print preview. So I want the msgbox not to open
when the printpreview is pressed. Any ideas?
Code BeforePrint:
If Worksheets("Order Form").Range("C3") = "You have not selected a customer
yet" Then
msg = "You have not yet selected a customer."
msg = msg & vbNewLine
msg = msg & "Are you sure you want to print?"
Ans = MsgBox(msg, vbYesNo + vbQuestion + vbDefaultButton2, "Print
Order")
If Ans = vbNo Then
Cancel = True
End If
End If
End Sub
Please help.
"JLGWhiz" wrote:
Put an If...Then statement in to only fire the message box when it is needed.
If this condition is met Then
'activate the message box
Else
'ignore this and go on with the code
End If
"art" wrote:
Hello:
I have a code that triggers a msgbox to open and ask the user yes or no.
However, there is certain times that the msgbox triggers but I don't need it.
How can I put in the code to close the msgbox. Please understand the the code
that triggers the msgbox is not in the same sub as the code that I want to
cancel the msgbox.
Thanks.
Art
|