+ Reply to Thread
Results 1 to 19 of 19

Macro To save as PDF of employee payslips

  1. #1
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Macro To save as PDF of employee payslips

    Hi all,

    i have a sheet of excel with employee payment details. In another sheet i have a template of the payslip of company. currently i have mapped the details of first sheet to the second sheet using vlookup. For every employee i change the emp id and save it as pdf with their employee id. i want it to be done for the whole employee list using a macro and the pdfs to be saved in a folder. If you want any other details please comment. I have attached a sheet for reference. It is similar to it. In it the macro is for printing the sheets whereas i want it for to save as pdf. Please help guys.

    PAYSLIPS.xlsm

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Macro To save as PDF of employee payslips

    What i'd do is save one as a PDF, using SaveAs, recording a macro of you doing it. Then you'll have your export to PDF code.

    Then you'll need to do a bit of research on for next loops to loop your data.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Macro To save as PDF of employee payslips

    Hi
    Try the attached workbook.
    Hope it helps.
    Good luck.
    Tony
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Re: Macro To save as PDF of employee payslips

    Thanks dude. But that is where i am getting the problem. PDFs are getting overwritten and the last pdf alone is available instead of multiple files.

  5. #5
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Macro To save as PDF of employee payslips

    Please Login or Register  to view this content.
    That's what I use to export the current sheet as a PDF. You could loop that and select whatever it is perhaps?

  6. #6
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Re: Macro To save as PDF of employee payslips

    Guys i am posting the sheet here. First sheet has the employee details. Second sheet have the template. My aim is to save pdfs of templates of all the employee in the list using a macro.

    currently i am doing it as

    1. In sheet 2, I lookup each employee using the serial number at the top left corner cell of the template.
    2. Once the details are updated in sheet 2 i save it as pdf in my desktop.

    Kindly help me.

    Thanks for all the guys for their replies :-)
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Macro To save as PDF of employee payslips

    Hi
    In the example I posted individual pdf's are created for each employee.
    Tony

  8. #8
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Re: Macro To save as PDF of employee payslips

    Tony,

    It shows a runtime error :-( in the example

    " Document not saved.the document may be open , or an error may have been encountered when saving. "
    Last edited by yemnirmal; 06-17-2014 at 08:50 AM.

  9. #9
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Macro To save as PDF of employee payslips

    Strange as it runs perfectly on my machine. Can you send a screeshot of your error.
    Tony

  10. #10
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Re: Macro To save as PDF of employee payslips

    please find the error Tony.

    Thanks in advance.
    Attached Images Attached Images

  11. #11
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Re: Macro To save as PDF of employee payslips

    please find the screenshot in the thread Tony. thanks in advance

  12. #12
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Macro To save as PDF of employee payslips

    Hi
    Thanks for the screenshot. Have you created a directory called "Payslips" on your "D" drive?
    Tony

  13. #13
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Re: Macro To save as PDF of employee payslips

    Thanks TONY. It works perfectly. I didnt create a folder previously. Thanks . I am new to macros. thanks for helping me out.

    One more doubt in the code.. you have calculate the array length using

    Set rRng = .Range(.Cells(5, 1), .Cells(.Rows.Count, 1).End(xlUp))

    whats that 5 and 1 cells denoting? of whic sheet?

  14. #14
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Macro To save as PDF of employee payslips

    Hi
    Glad it is working okay now.
    That determines what the last populated row number in Sheet1 i.e. how many employees dos the program have to create payslips for.
    Cells(5, 1) means - row 5 column 1.
    Hope this helps.
    Tony

  15. #15
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Thumbs up Re: Macro To save as PDF of employee payslips

    Thanks Tony. For educating me. Really nice of you :-)

  16. #16
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Re: Macro To save as PDF of employee payslips

    Tony can you help me with this query ?

    Now that i have a set of PDF files saved in a local folder saved as their respective employee id. I have an excel sheet with employee ids pointing towards their mail id. i have configured outlook. Can you help me how to create a macro to send automated emails with their respective attachments.?

    Thanks in advance.

  17. #17
    Registered User
    Join Date
    06-16-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    29

    Re: Macro To save as PDF of employee payslips

    Got the answer for the query in other posts thanks guys !!

  18. #18
    Registered User
    Join Date
    07-24-2014
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    13

    Re: Macro To save as PDF of employee payslips

    Hi tony,

    I am use the Same code but i am created only one employee could you please help me.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    09-24-2012
    Location
    Lagos
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Macro To save as PDF of employee payslips

    Quote Originally Posted by yemnirmal View Post
    Got the answer for the query in other posts thanks guys !!
    Yemnirmal, can you please share the code on the automated saved pdf to outlook email?

+ 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 payslips to pdf and send them to emails
    By alahmadtamer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2013, 04:40 AM
  2. Save payslips as pdf
    By crychnun in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2012, 01:40 PM
  3. [SOLVED] Generate payslips of employee on a list
    By oluwafog in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 04-17-2012, 11:16 PM
  4. Templates/payslips/macros
    By Erve in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2010, 12:31 PM
  5. Creating payslips
    By si_ako in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2007, 01:32 AM

Tags for this Thread

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