I am using Excel & Outlook 2013 and am having difficulty getting a file to attach to an email using a macro in excel. The code I am using is below. The macro creates the email fine, but does not include the attachment in the file. I have checked to make sure the file path is correct and it is.
Any help you can provide is appreciated.
Sub Mail_File_AC()
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 = "email@email.com"
.CC = ""
.BCC = ""
.Subject = "Subject Line"
.Body = "Body Message"
.Attachments.Add ("C:\Users\hrc.csv")
.Display
'.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Any help you can provide is appreciated.
Sub Mail_File_AC()
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 = "email@email.com"
.CC = ""
.BCC = ""
.Subject = "Subject Line"
.Body = "Body Message"
.Attachments.Add ("C:\Users\hrc.csv")
.Display
'.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub