Annoying messagebox

Dûrs

New Member
Joined
Jul 10, 2007
Messages
11
I have a somewhat "thrown together" spreadsheet which includes the following macro:

Sub IBEP()

Sheets(1).Copy
ActiveWorkbook.SendMail Recipients:="xxxxx@xxxxxx", Subject:="xxxxxxxxxxxxxx"
ActiveWorkbook.Close
MsgBox ("Thank you - Your form has now been sent. There is no need to send again as an attachment.") '

End Sub

The idea here is that one sheet within a spreadsheet document is copied and mailed off and the new document 'Book1' is closed. All works well except you get the inevitable messagebox asking whether or not you want to save Book1. Once this is up and running properly I'd rather the users didn't havcee the option to save Book 1 and it was always gotten rid of automatically. Does anyone have a solution?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try using

Code:
Application.DisplayAlerts = False

set it to True before your code exits.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

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