I’m going to create advanced message box for my application. Look my code
' If MsgBox("Are you sure you start Control Center ?", vbYesNoCancel + vbDefaultButton2 + vbQuestion) <> vbYes Then
If AdvMsgBox("Are you sure you start Control Center ?", vbYesNoCancel + vbDefaultButton2 + vbQuestion) <> vbYes Then
Private Function AdvMsgBox(sMsg As String, lButton As Long, Optional sTitle As String = "", Optional sContent As String = "") As Long
‘Is there way to check in this style ? This should works, but it always add button, even if I do not send ‘params. Where is the error?
If (lButton Or vbOK) Then MyButtons = MyButtons Or ButtonOk
If (lButton Or vbNo) Then MyButtons = MyButtons Or ButtonNo
If (lButton Or vbAbort) Then MyButtons = MyButtons Or ButtonNo ‘ in this example here should be not enter, but it does!
Please help. Of course, I have solution with Case where to determine all possible flag of msgBox, I use not more than 10, but I prefer more intelligent solution.