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

johnlink

New Member
Joined
Nov 24, 2017
Messages
6
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.
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

johnlink

New Member
Joined
Nov 24, 2017
Messages
6
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-here/1096924-testing-image-my-worksheet.html
 
Last edited by a moderator:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,155
Office Version
365
Platform
Windows
Cross posted https://chandoo.org/forum/threads/vba-code-for-emailing-payslips.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.
 

Watch MrExcel Video

Forum statistics

Threads
1,099,932
Messages
5,471,594
Members
406,770
Latest member
livetolearn4life

This Week's Hot Topics

Top