+ Reply to Thread
Results 1 to 4 of 4

Issue with attaching files to an email through VBA

  1. #1
    Registered User
    Join Date
    04-27-2020
    Location
    UK
    MS-Off Ver
    2010
    Posts
    55

    Issue with attaching files to an email through VBA

    Hi all,
    Hoping someone will be able to offer some assistance in getting attachments to an email working, as I seem to be having no luck and after trying a few things I'm just lost. (Am still relatively new to using VBA so apologies in advance.)

    I'm having a decent amount of success with the rest of the code after a few hours of almost leaving a laptop shaped hole in a perfectly good window. This is what I have so far:

    Please Login or Register  to view this content.


    When I run the macro, I am getting the following back:

    'Run-time error '440':
    The operation has failed.

    When I debug, the line in question is .Attachments.Add = srcF



    (I appreciate the way of opening the file might not be the best, but macro recorder works well enough so I'm happy with that for now, though wouldn't mind learning a better way)

    Forgot to mention, am using Excel 2010.

    I posted the same question on reddit here https://www.reddit.com/r/excel/comme...email_via_vba/ but remembered I had much more luck on here in the past after posting and so am trying my luck here again.

    Any help would be greatly appreciated!
    Thanks, Max
    Last edited by Valont; 01-12-2022 at 06:56 AM. Reason: Solved!

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,015

    Re: Issue with attaching files to an email through VBA

    Remove the = sign from that line.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    04-27-2020
    Location
    UK
    MS-Off Ver
    2010
    Posts
    55

    Re: Issue with attaching files to an email through VBA

    Quote Originally Posted by rorya View Post
    Remove the = sign from that line.
    This is so simple I want to cry. It works.
    Thank you <3

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,015

    Re: Issue with attaching files to an email through VBA

    It's always the little things.

    Glad we could help, and thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Corrupted files when attaching and emailing files from SharePoint
    By L plates in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2021, 06:25 AM
  2. [SOLVED] Send email from userform with option for attaching files
    By nordicdust in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-17-2019, 03:00 AM
  3. Text files not attaching to email correctly
    By MikeFranz123 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-31-2014, 09:02 AM
  4. Macro for attaching files into Outlook email - 95% complete but....
    By heatwave in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 01:30 AM
  5. Attaching files to an email
    By damage in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2011, 01:14 PM
  6. Attaching files to an email through excel
    By damage in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2011, 08:37 AM
  7. Attaching One Worksheet to Email
    By KeshnerH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1