Add Workbook to a Mail Attachment - VBA

Occasional Visitor



Is there a VBA code to Add Workbook to a Mail Attachment ?

2 Replies


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 = ""
        .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
         'Here the mail is immediately placed in the outbox
End With
End Sub




At the same time, I can only recommend this site.

Mail from Excel


I would be happy to know if I could help.



Was the answer useful? Mark them as helpful!

This will help all forum participants.