Run-time error "Method "Add" of object "Attachments" failed"

Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
385
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Dear all,

I am trying to run a macro that sends out emails, however when I try to run it I keep getting this error unfortunately:

1642683535626.png


Can somebody please help me figure out why? I have tried setting source = ThisWorkbook.FullName (takes the current excel file I am typing in as an attachment) before and then typing EmailItem.Attachments.Add Source with no issues.

For some reason this gives me an error now with the debug highlighting EmailItem.Attachments.Add Source

Can somebody figure out why?

Would be immensely greatful!

Kind regards
Jyggalag
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
39,825
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
If you add Msgbox Source before that line does it show the correct path?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
385
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
UPDATE: I Believe the error was that I had a & _ at the end of my body code for the email without any text coming after!!

Apologies @RoryA and thank you so very much for your help!! :)
 
Solution

Forum statistics

Threads
1,181,974
Messages
5,933,031
Members
436,872
Latest member
Nickytoo

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
Top