CP212 : Sample Message Box Code

Sub msgDialogBoxExamples()
    ' Different ways to use a dialog box
    Dim msg As String
    Dim title As String
    Dim result As VbMsgBoxResult
    
    msg = "Do you like this message?"
    title = "Message Example"
    
    ' Very basic
    MsgBox msg
    
    ' A little more professional
    ' If skipping a parameter you must include the extra comma.
    MsgBox msg, , title
    
    ' Return the value of a button that was pressed
    ' Using OR allows you to combine button options
    result = MsgBox(msg, vbYesNo Or vbQuestion, title)
    
    If result = vbNo Then
            MsgBox "You didn't like my message!", vbExclamation, "Says you!"
    ElseIf result = vbYes Then
        MsgBox "I thought you would.", vbInformation, "I like you."
    End If
    
End Sub