+ Reply to Thread
Results 1 to 13 of 13

PDF attachment to email

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    19

    PDF attachment to email

    Hi All

    I have a problem with adding an attachment to an email . It's been driving me mad for days.

    I can create the email no problem but the email is just a part of a macro which saves a sheet from the workbook to pdf and sends it to a folder and then clears the form for the next entry. The problem I'm having as attaching the saved pdf to the email. I've tried every combination of address for the file imaginable without success to create the attachment. I've added the code to see if anyone can see where I'm going wrong. I've left my last attempt at the address in the .Attachments line for you to see

    Kind regards

    Paul

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: PDF attachment to email

    Hi, hopefully you can ammend this procedure to your needs
    Attached Files Attached Files
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  3. #3
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: PDF attachment to email

    Hi Paul,
    Please refer to this thread.
    http://www.excelforum.com/excel-prog...ml#post3148447
    I was helped by JBeaucaire
    It may help
    Kind regards

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: PDF attachment to email

    You may try:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-21-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    19

    Re: PDF attachment to email

    Hi All

    I've just been going through your replies, I can see how they are supposed to work . I've tried your code Izandol as it was the easiest to implement. But it still will not add the attachment???

    I noticed in your code Sean an item:

    Please Login or Register  to view this content.
    Could this be what is missing from my code? Or could it be something in the settings? I'm running on widows 8.1 and office 2013

    Regards

    Paul

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: PDF attachment to email

    Does the value in cell AE1 have the ".pdf" extension included?

  7. #7
    Registered User
    Join Date
    11-21-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    19

    Re: PDF attachment to email

    The value in cell AE1 of the Ofgem Report sheet is just the job number. It is imported (via a linking formula from the input sheet of the same workbook)

    it is added to the file name for identification and into the email for reference.

  8. #8
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: PDF attachment to email

    I suggest you change one line:
    Please Login or Register  to view this content.
    to this:
    Please Login or Register  to view this content.
    If there are still errors, remove the On Error Resume Next line and try to run the code again.

  9. #9
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: PDF attachment to email

    Your pathing is probably written incorrectly.

    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: PDF attachment to email

    Hi,
    My version uses early binding, your version is late binding and therefore does not require a reference to outlook object library.

  11. #11
    Registered User
    Join Date
    11-21-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    19

    Re: PDF attachment to email

    Hi Izandol

    You are a genius!! worked perfectly

    For future reference for everyone here is the final code.

    This code does the following:

    Saves the sheet to a folder as a pdf. with the correct file name (this is the job number in AE1)

    It then creates an email with the correct Reference in the Subject field and adds the reference to the content of the email

    It attaches the pdf to the email

    It clears the entry sheet ready for the next input.

    Thanks to everyone for their help

    Kind regards

    Paul

    I have one more thing that I'd like to achieve with this workbook but it's a different subject so I'll put it in another post


    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    11-21-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    19

    Re: PDF attachment to email

    Final message

    how do i mark this as solved?

  13. #13
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: PDF attachment to email

    According to the Forum Rules:
    Click Thread Tools above your first post, select "Mark your thread as Solved"

+ 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. email excel file or worksheet as an attachment to multiple email addresses
    By jgeagle5 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2009, 03:40 PM
  2. Email to - as an attachment
    By sabbur in forum Excel General
    Replies: 1
    Last Post: 09-09-2009, 01:48 PM
  3. Email Open Workbook as an Attachment to Email
    By BazzaBoy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2009, 06:19 PM
  4. vba for email attachment
    By reggie1000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2009, 12:38 PM
  5. Attachment to an email
    By edger in forum Excel General
    Replies: 0
    Last Post: 02-09-2006, 02:00 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