+ Reply to Thread
Results 1 to 12 of 12

vba code for email attachments

  1. #1
    Forum Contributor
    Join Date
    02-27-2015
    Location
    Norge
    MS-Off Ver
    2019
    Posts
    357

    vba code for email attachments

    Hello

    i want to add attachments when sending mail i wish to use ThisWorkbook.Path because folder name change

    .Attachments.Add
    Last edited by dodde; 05-28-2020 at 07:12 AM.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    6,825

    Re: vba code for email attachments

    Hi,
    I suggest you do a search on this forum, there are quite many similar questions which with some editing can be made to work for you.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Contributor
    Join Date
    02-27-2015
    Location
    Norge
    MS-Off Ver
    2019
    Posts
    357

    Re: vba code for email attachments

    Hello

    ok i do so

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    6,825

    Re: vba code for email attachments

    If you find something you can use and need additional help, just tell us.
    I also suggest you attach a sample file with non-private data for testing and where you explain everything

  5. #5
    Forum Contributor
    Join Date
    02-27-2015
    Location
    Norge
    MS-Off Ver
    2019
    Posts
    357

    Re: vba code for email attachments

    Hello

    I try to modify because i did not find, but i miss some thing because the file will not attach, but i dont get any error

    see line i red

    Please Login or Register  to view this content.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    6,825

    Re: vba code for email attachments

    First of all, are you sending using Excel or is this Outlook VBA?

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    6,825

    Re: vba code for email attachments

    You are forgetting to create item

    [code]
    With OutMail.CreateItem(0)
    .Display 'or use .Send
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Prisoverslag " & ThisWorkbook.Sheets("Tilbud Voortman").Range("S5").Value
    .HTMLBody = strbody & "<br>" & .HTMLBody
    .Attachments.Add Destwb.FullName
    'You can add other files also like this
    .Attachments.Add ThisWorkbook.Path & ("\Supplerende_bestemmelser_til_8415 EMV.docx") '("C:\test.txt")
    '.Attachments.Add ("C:\test.txt")

  8. #8
    Forum Contributor
    Join Date
    02-27-2015
    Location
    Norge
    MS-Off Ver
    2019
    Posts
    357

    Re: vba code for email attachments

    Hello

    i have this line also, here is code

    i get error paste in code so i put the wb here
    Attached Files Attached Files

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,010

    Re: vba code for email attachments

    Please Login or Register  to view this content.
    Last edited by sintek; 05-28-2020 at 06:41 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere.....
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember......Mark Thread as Solved.
    Excel Forum Rocks!!!

  10. #10
    Forum Contributor
    Join Date
    02-27-2015
    Location
    Norge
    MS-Off Ver
    2019
    Posts
    357

    Re: vba code for email attachments

    Hello

    This work thank you

    It sholud have stand Thank You in your Reputation
    Last edited by dodde; 05-28-2020 at 07:14 AM.

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    6,825

    Re: vba code for email attachments


    Good to know it works

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,010

    Re: vba code for email attachments

    ..........................
    THANKS.gif

+ 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. Print email and attachments in hyperlinks in the email
    By mediocrerecord in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 08-07-2018, 02:03 AM
  2. Bad File Name error 52- Code to group email attachments
    By L_Misty in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 09-06-2017, 07:33 PM
  3. [SOLVED] Email With Attachments - Failing
    By Logit in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-22-2016, 02:16 AM
  4. VB Code to send email with attachments
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2016, 03:58 PM
  5. [SOLVED] Sending Email with attachments
    By cory0789 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2015, 03:07 PM
  6. Replies: 0
    Last Post: 02-21-2013, 04:46 AM
  7. [SOLVED] Email attachments possible??
    By aaronp in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 12-03-2012, 03:32 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