Need Code For Popup Window Stating Email Was Sent (VBA)

bobsargent2002

New Member
Joined
May 23, 2018
Messages
4
Hello,
I use the following code to automatically email a spreadsheet when a button is clicked on the sheet. The issue is that I cannot figure out how to have a popup window show up stating "Thank you. Your status update has been submitted.". Can anyone help?
Code:
Private Sub CommandButton3_Click()
Dim OL              As Object
Dim EmailItem       As Object
Dim Doc             As Workbook
 
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveWorkbook
Doc.Save
 
With EmailItem
    .Subject = "Status Update Form"
    .Body = "Attached is an update for our store."
    .To = "Enter Email Address Here"
    .Importance = olImportanceNormal
    .Attachments.Add Doc.FullName
    .Send
End With
 
Application.ScreenUpdating = True
 
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub

Thanks in advance,
Bob
 
Last edited by a moderator:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
How about
Code:
Private Sub CommandButton3_Click()
Dim OL              As Object
Dim EmailItem       As Object
Dim Doc             As Workbook
 
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveWorkbook
Doc.Save
 
With EmailItem
    .Subject = "Status Update Form"
    .Body = "Attached is an update for our store."
    .To = "Enter Email Address Here"
    .Importance = olImportanceNormal
    .Attachments.Add Doc.FullName
    .Send
End With
 
Application.ScreenUpdating = True
[COLOR=#ff0000]MsgBox "Thank you. Your status update has been submitted."
[/COLOR]
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top