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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try using

Code:
Application.DisplayAlerts = False

set it to True before your code exits.
 
Upvote 0

Forum statistics

Threads
1,222,032
Messages
6,163,506
Members
451,839
Latest member
HonestZed

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