Email Macro

lawre2000

Board Regular
Joined
Sep 11, 2008
Messages
188
Hello,

I have the following macro below however the file is not attaching to the email. Any suggestions? Thanks!

Sub Send()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Dim user As Variant

user = Sheets("Instructions").Range("H20").Value



Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = Sheets("Instructions").Range("H21").Value
On Error Resume Next
With OutMail
.To = Sheets("Instructions").Range("H20").Value
.CC = ""
.BCC = ""
.Subject = "Weekly Power Report"
.body = strbody

.Attachments.Add ("H:\PALMERL\Power Report Test")
'.Send
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I don't see a file name...only a folder path.

.Attachments.Add ("H:\PALMERL\Power Report Test")

If Power Report Test is the actual file, adding ".xls" or ".txt" may solve the issue.
 
Upvote 0
Yes, that was an error on my part. I have added the .xls extension and the line now reads:

.Attachments.Add ("H:\PALMERL\Power Report Test.xls")

However, the file is not attaching?
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,707
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top