+ Reply to Thread
Results 1 to 7 of 7

VBA Code to Print one or All Employee Payslip From Payroll Register

  1. #1
    Registered User
    Join Date
    07-04-2020
    Location
    Dubai
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2404 Build 16.0.17531.20190) 64-bit
    Posts
    45

    VBA Code to Print one or All Employee Payslip From Payroll Register

    Hello,

    I dont know how to use VBA code and would like to know how to create a button on the payslip sheet to print to pdf a salary slip of either one employee or all employees based on employee name.

    Also is it possible to print the pdf to a location with different folders month wise based on the period? For example Payslips of September to September 2024, October 2024 etc.

    Attached sample file for reference.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,271

    Re: VBA Code to Print one or All Employee Payslip From Payroll Register

    The most basic way.

    Please Login or Register  to view this content.
    Last edited by bakerman2; 11-25-2024 at 06:51 PM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    07-04-2020
    Location
    Dubai
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2404 Build 16.0.17531.20190) 64-bit
    Posts
    45

    Re: VBA Code to Print one or All Employee Payslip From Payroll Register

    Hello

    Thank you. I am unable due to some error.

    Please see attached excel file and screenshot for your reference.
    Attached Images Attached Images
    Attached Files Attached Files

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,271

    Re: VBA Code to Print one or All Employee Payslip From Payroll Register

    Had to change some sheetnames and connect button with correct code.
    Make sure you have the Directory 'G:\Payslips\November 2024' on your HD.
    For single pdf select name and click Print Single Pdf button.
    To print all names in Register sheet just press Print Multiple Pdf button.

  5. #5
    Registered User
    Join Date
    07-04-2020
    Location
    Dubai
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2404 Build 16.0.17531.20190) 64-bit
    Posts
    45

    Re: VBA Code to Print one or All Employee Payslip From Payroll Register

    Hi @Bakerman2.

    Many thanks. File works great.

    A quick question if I may. I inserted a picture of my esignature on the payslip. However when I click on the print button it only prints the file without signature. Any way to work around this?

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,271

    Re: VBA Code to Print one or All Employee Payslip From Payroll Register

    Is the Print Object ticked in the Size and Properties options of the image ?

  7. #7
    Registered User
    Join Date
    07-04-2020
    Location
    Dubai
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2404 Build 16.0.17531.20190) 64-bit
    Posts
    45

    Re: VBA Code to Print one or All Employee Payslip From Payroll Register

    Hello
    Yes it is

+ 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. Replies: 33
    Last Post: 02-02-2023, 06:42 AM
  2. [SOLVED] Create Payroll PDF from Excel, set a separate password for each payslip, send via Outlook
    By huyenkim10116 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2020, 03:13 AM
  3. [SOLVED] How to generate payslip and print it all at once
    By macnabong in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2014, 02:36 AM
  4. [SOLVED] HOW to prepare payroll in macros and generate payslip in EXCEL 2003
    By sysen_aee in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-21-2014, 06:39 AM
  5. Replies: 2
    Last Post: 04-04-2013, 07:27 AM
  6. tracking payroll by employee's first name
    By losgatosmama in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-24-2011, 04:28 AM
  7. Creating An Employee Register
    By Hoopsah in forum Excel General
    Replies: 3
    Last Post: 08-24-2007, 02:23 PM

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