Saturday, April 20, 2019

Active Workbook in an Email


Active Workbook in an Email
Use this macro code to quickly send your active workbook in an e-mail. You can change the subject, email, and body text in code. And if you want to send this mail directly, use ".Send" instead of ".Display".
Sub Send_Mail()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.to = "Sales@FrontLinePaper.com"
.Subject = "Growth Report"
.Body = "Hello Team, Please find attached Growth Report."
.Attachments.Add ActiveWorkbook.FullName
.display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Add Workbook to a Mail Attachment

Once you run this macro it will open your default mail client and attached active workbook with it as an attachment.
Sub OpenWorkbookAsAttachment()
Application.Dialogs(xlDialogSendMail).Show
End Sub

No comments:

Post a Comment