VBA code for emailing payslips from excel source file as pdf's to multiple employees.
Results 1 to 3 of 3

Thread: VBA code for emailing payslips from excel source file as pdf's to multiple employees.
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Nov 2017
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question VBA code for emailing payslips from excel source file as pdf's to multiple employees.

    Hi I am rather new to VBA but have used Excel for some time. I have an excel file dump of employee payslips each week. All employees are contained in the one worksheet - structure of data is regular so a search for a key cell value eg "Earnings Summary" at the start of each payslip then create a range possibly using offset and an end marker at the next down "Earnings Summary" cell. From this selected range I then need to issue an email to the employee (email address is stored in another worksheet can be a vlookup) and attach a pdf of the payslip range selected. Following this I need the code to loop on down to the next payslip and do the same until the end of the file is reached. Needs to be fully automated if possible so can be done each payday by others. Also the worksheet is locked so may need to do a "save as" copy at the start of the code. Hope this makes sense and I look foward to any helpful replies from others who may have solved this. Many thanks. Johnlink.

  2. #2
    New Member
    Join Date
    Nov 2017
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA code for emailing payslips from excel source file as pdf's to multiple employees.

    I have decided to break down the task into steps. I am attaching the data dump file image (all names changed for privacy). First step I need to have a macro loop through the file and find and delete all the data shaded yellow for ea employee per the yellow shaded example for 1st employee.
    First yellow patch deletion can be a bunch of rows selected and deleted according to their position between the key marker cells - Earning Details A11 & Leave Accrued A27 (for 1st employee). Next yellow patch will need a range of cells selected and a CLEAR ALL exectued. Then the last yellow lot will be a set of rows to delete. Then cycle on to the next employee.
    Thanks.

    EDIT:
    Table can be seen here
    https://www.mrexcel.com/forum/test-h...worksheet.html
    Last edited by Fluff; May 8th, 2019 at 06:58 AM. Reason: Removed HTML code

  3. #3
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,519
    Post Thanks / Like
    Mentioned
    444 Post(s)
    Tagged
    45 Thread(s)

    Default Re: VBA code for emailing payslips from excel source file as pdf's to multiple employees.

    Cross posted https://chandoo.org/forum/threads/vb...ayslips.41633/

    While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
    This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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