logo
search
VBA & Macro Problems

How to Add an Excel VBA Confirmation Message After Sending Email

Guest WriterGuest Writer Sep 25, 2026 871 views

Question details

The user wants to display a confirmation pop-up message or visual indicator immediately after an Excel VBA macro successfully sends an email.

How to Add an Excel VBA Confirmation Message After Sending Email
Product
Excel
Device & OS
not provided
Scenario
Running a VBA macro to send an email from an Excel order form and needing immediate user feedback upon successful completion.
Observed behavior
Currently, users press a command button to send the email but receive no immediate on-screen feedback, requiring them to wait for an automatic reply to know if the process worked.
Before you start

Ensure your VBA macro for sending the email is fully set up, tested, and functioning correctly without errors before adding the final confirmation notification.

Solution 1Recommended

Add a MsgBox Pop-up Confirmation

The most direct way to notify users is by triggering a pop-up message box immediately after the email dispatch command in your VBA script.

A MsgBox halts the code execution and forces the user to acknowledge the prompt before continuing, making it perfect for definitive success confirmations.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) Editor, and locate the module containing your email-sending macro.

2
Locate the end of the email procedure

Scroll down to the end of your VBA script, directly after the line of code that actually sends the email (usually .Send).

3
Insert the MsgBox code

Type the following line of code: MsgBox "SENT", vbInformation, "Confirmation". You can customize the word "SENT" to "Email sent successfully!" for a more descriptive notification.

4
Save and test the macro

Save your workbook as a Macro-Enabled Workbook (.xlsm). Click the command button on your worksheet to run the macro and verify that the pop-up appears after the email sends.

Add a MsgBox Pop-up Confirmation
Customizing the Message Box: The 'vbInformation' parameter adds a blue 'i' icon to your pop-up box, giving it a professional appearance. You can change the title text by replacing "Confirmation" with any string you prefer.

Use WPS Spreadsheet to Run and Edit VBA Macros

WPS Office offers robust, seamless support for VBA macros, allowing you to easily run, edit, and create automation scripts like email dispatching and confirmation pop-ups.

  1. 1. Open your macro file in WPS Office: Launch WPS Spreadsheet and open your existing Macro-Enabled Workbook (.xlsm).
  2. 2. Access the Developer tab: Navigate to the 'Developer' tab on the top ribbon menu. If it's not visible, you can enable it from the application settings.
  3. 3. Open the VBA Editor: Click on 'Visual Basic' to launch the VBA environment, where you can paste or modify your MsgBox confirmation code seamlessly.
Fully compatible with Microsoft Excel (.xlsm) macro filesBuilt-in robust VBA editor for writing and debugging scriptsEasily link command buttons to macros on the spreadsheet interfaceLightweight architecture for fast execution of complex codes
microsoft office alternative - wps office

Frequently Asked Questions

Can I add a Yes/No prompt to confirm before the email is actually sent?

Yes. You can use the MsgBox function with the vbYesNo argument at the beginning of your macro to ask the user for confirmation before executing the code. For example: If MsgBox("Are you sure you want to send this email?", vbYesNo) = vbNo Then Exit Sub.

Why doesn't my VBA confirmation message appear after clicking the button?

This usually happens if the macro encounters an error and stops before reaching the MsgBox line, or if the procedure branches off using GoTo statements or Exit Sub commands. Ensure the MsgBox code is placed directly in the successful execution path.

Is it possible to include the recipient's email address in the confirmation message?

Yes. You can concatenate variables within the MsgBox function. For instance, if your recipient is stored in a variable called strEmail, you can write: MsgBox "Email successfully sent to " & strEmail, vbInformation, "Confirmation".