+ Reply to Thread
Results 1 to 15 of 15

Create Individual PDF file for attachment based on data in excel

  1. #1
    Forum Contributor
    Join Date
    06-24-2013
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    199

    Create Individual PDF file for attachment based on data in excel

    Good day dears!

    I am looking for a macro that can create a letter based on data provided in excel, save this letter as individual PDFs and attached it in an email. Have found a sample workbook and tried to modify it according to my needs, however, the rest of the letter is not being copied in the PDF created and the 2 pictures should be visible as well. Also need to ensure that if column C is the same for any rows, it should only create one email which contains all data in column B. Subject of email should be "Letter Template + whatever data is in column C"

    I have attached the macro i found plus the sample pdf that should be attached in the email.

    Hope somebody can help me here... Looking forward to all your expert assistance.

    Thank you in advance!!
    Attached Files Attached Files

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Create Individual PDF file for attachment based on data in excel

    hello Melody,

    the first issue you need to take a look at is your loop. see the image. it is not running, because the start counter is greater than the end counter. so your emailing function is not even being called....
    Attached Images Attached Images

  3. #3
    Forum Contributor
    Join Date
    06-24-2013
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    199

    Re: Create Individual PDF file for attachment based on data in excel

    the thing is i just copied entirely the code from some file here... can you help me fix the error please?

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Create Individual PDF file for attachment based on data in excel

    Quote Originally Posted by melody10 View Post
    the thing is i just copied entirely the code from some file here... can you help me fix the error please?
    well I'm sure you did. I would encourage you to learn the stuff that you download. if you do too much of that, you could find yourself in trouble, without much help at your fingertips. here's some assistance, since you asked. you have many issues going on. the PDF name is obviously not what you want (see image 2 below). the person you are sending it too as well, is incorrect (see image 1 below). so, clarification is certainly needed on both of these blocks of words from you, in terms of what you're looking for:
    e rest of the letter is not being copied in the PDF created and the 2 pictures should be visible as we
    Also need to ensure that if column C is the same for any rows, it should only create one email which contains all data in column B
    there is nothing in column ''c'' that is indentifying in nature. the image is sitting on top of the grid, it is not in any given column.
    Attached Images Attached Images

  5. #5
    Forum Contributor
    Join Date
    06-24-2013
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    199

    Re: Create Individual PDF file for attachment based on data in excel

    thank you dear for taking that time to check.. as you noticed, i am very new in VBA and hence would appreciate if your could help me, maybe create a new file from scratch?

    basically the general requirement is to create 1 email with a PDF attachment, for every unique data in column C (sheetname: ALL STAFF (PAYSLIPS))

    1. PDF attachment should be updated as per details found in the same sheet. have highlighted all in yellow the fields that must be updated.
    2. PDF attachment should have include 2 images, a logo on top of the letter and a stamp at the lower section

  6. #6
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Create Individual PDF file for attachment based on data in excel

    I made a number of changes to your code to try and meet your requirements. To populate the payslip letter, I added a new sub. Try it out and let us know if you have questions. Changes are annotated in the code. I was unable to address all the issues that Adam astutely brought up, but tried to provide a working file nonetheless.
    Attached Files Attached Files
    Last edited by maniacb; 09-28-2020 at 10:27 AM. Reason: update response

  7. #7
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Create Individual PDF file for attachment based on data in excel

    Melody,

    since maniacb has joined here, I will see what he has to offer you does what you need. get back to everyone and let us know what happens and what questions come up after that. if all else fails, I'll do some work for you. why not...

  8. #8
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Create Individual PDF file for attachment based on data in excel

    To send one email for duplicate count, you are looking for duplicates in Column C, not emails column G? How many duplicates do you expect to have at once? More than 2? Up to how many?

  9. #9
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Create Individual PDF file for attachment based on data in excel

    I made changes to support up to four duplicate bill of ladings
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    06-24-2013
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    199

    Re: Create Individual PDF file for attachment based on data in excel

    it's perfect!!!! well.. almost... i am not really sure how many is the maximum duplicates in column C is possible in the future. is it possible to edit it to change the number of maximum duplicates? but for now this is workable from me. i really appreciate your help!!

    vba_php... super thank youu for your time in checking my concerns..

    really big help from you both

  11. #11
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Create Individual PDF file for attachment based on data in excel

    I didn't help. but okie dokie! LOL

  12. #12
    Forum Contributor
    Join Date
    06-24-2013
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    199

    Re: Create Individual PDF file for attachment based on data in excel

    hello maniacb... sorry found one issue on the macro... when there are the same email address (in column G), it just generating 1 pdf / email. it should create 1 email per booking number (column C). so if [email protected] has 5 bookings, he should received 5 different emails, with 5 different attachments. can you help?

    hope i explained my self well.

  13. #13
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Create Individual PDF file for attachment based on data in excel

    Sure, I assumed each booking number had a one to one relationship with the email. I need to do some rearranging. You should see an improved solution by tomorrow.

  14. #14
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Create Individual PDF file for attachment based on data in excel

    Here you go
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    06-24-2013
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    199

    Re: Create Individual PDF file for attachment based on data in excel

    super super thanks!!! perfect!!

+ 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. [SOLVED] Copy the data from Master file and paste into individual excel file as per criteria
    By Vikas_k in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-30-2023, 09:15 AM
  2. Replies: 0
    Last Post: 02-28-2019, 04:03 AM
  3. Break out excel file into individual sub files based on checked boxes
    By Alive05 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2018, 05:39 AM
  4. Replies: 0
    Last Post: 01-20-2015, 10:07 PM
  5. [SOLVED] Automatically Copy Data in Excel File upon opening email attachment
    By rachaelgoldman1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2013, 05:21 AM
  6. Replies: 6
    Last Post: 03-18-2013, 01:11 PM
  7. Copy data to an individual file based on drop down list
    By xlnewbe in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-05-2007, 01:52 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