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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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