Decoding VBA Start learning

Beginner track

MsgBox and Basic User Feedback | Decoding VBA

Confirm actions and report macro results to the person running the workbook.

Goal

Give clear success and error messages without blocking automation unnecessarily.

Example

Option Explicit

Sub RunWithConfirmation()
    Dim response As VbMsgBoxResult

    response = MsgBox("Export the current report?", vbYesNo + vbQuestion, "Decoding VBA")
    If response = vbYes Then
        ' Call export routine here
        MsgBox "Export complete.", vbInformation, "Decoding VBA"
    End If
End Sub

Next up

Build your first end-to-end workplace macro.

Back to Beginner lessons