Forum Discussion
SaraAb
Sep 28, 2021Copper Contributor
Add Workbook to a Mail Attachment - VBA
Hello,
Is there a VBA code to Add Workbook to a Mail Attachment ?
2 Replies
- NikolinoDEPlatinum Contributor
Here is a VBA code and an example file.
Sub Excel_Workbook_send_with_Outlook_() Dim Nachricht As Object, OutApp As Object Set OutApp = CreateObject("Outlook.Application") Dim AWS As String 'The active workbook is sent as a mail AWS = ThisWorkbook.FullName InitializeOutlook = True Set Nachricht = OutApp.CreateItem(0) With Nachricht .To = "lino.excelsius@gmail.com" .Subject = " Test report from Microsoft Excel Community " & Date & Time .attachments.Add AWS .Body = "This is a Test." & vbCrLf & " Please ignore this message " 'The mail is displayed again here .Display 'Here the mail is immediately placed in the outbox 'Mail.Send End With End SubAt the same time, I can only recommend this site.
I would be happy to know if I could help.
NikolinoDE
Was the answer useful? Mark them as helpful!
This will help all forum participants.
- Juliano-PetrukioBronze Contributor
https://trumpexcel.com/send-single-excel-worksheet-email-attachment/