gleamng
Board Regular
- Joined
- Oct 8, 2016
- Messages
- 98
- Office Version
- 365
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- 2003 or older
- Platform
- Windows
- MacOS
- Mobile
- Web
Good evening house
please i need help with the macro below,
the macro generate payslip for each row (that is if i have 10 records, it created 10 pdf files
what i want now is for the macro to generate one single file with each record per page (i.e 10pages pdf file)
thanking you for your help
please i need help with the macro below,
the macro generate payslip for each row (that is if i have 10 records, it created 10 pdf files
what i want now is for the macro to generate one single file with each record per page (i.e 10pages pdf file)
thanking you for your help
VBA Code:
Option Explicit
Sub Slip()
On Error Resume Next
MkDir "C:\Payslip"
Sheet5.Range("A1:D32").ExportAsFixedFormat xlTypePDF, Filename:="C:\Payslip\" & Sheet5.Range("F3").Value, openafterpublish:=False
End Sub
Sub PDF_PAYSLIP()
Application.ScreenUpdating = False
On Error Resume Next
MkDir "C:\Payslip"
Dim x As Long
Dim y As Long
x = Sheet2.Range("A" & Rows.Count).End(xlUp).Row
For y = 4 To x
If Len(Sheet2.Cells(y, 1).Value) > 0 Then
Sheet5.Range("F3").Value = Sheet2.Cells(y, 1)
End If
Call Slip
Next y
MsgBox "Pay Slips successfully generated"
End Sub