Today’s macro is helpful if you send a lot of excel files via email. Running the macro will create a new Microsoft Outlook email with the last saved version of the open workbook. By default the email will not be addressed to anyone, the subject of the new email will be the name of workbook, and the body will be “See attached.” These settings can be customized by editing the macro code below. It might be helpful to change the to: line to the email address of your supervisor or someone you send your spreadsheets to often.
Excel Macro Code:
Sub Mail_Workbook() Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = "" .CC = "" .BCC = "" .Subject = ActiveWorkbook.Name .body = "See attached." .Attachments.Add ActiveWorkbook.FullName .Display End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub
View the full listing of VBA macros.