I have created a code to generate all payslip of our employees to pdf. when the code is run, it generates pdf files in a certain folder with filename of the employees.
Now what i need is to email the pdf as attachment to email address of the employees. PLease help. Thanks!
here is my code:
Sub CommandButton2_Click()
Dim Rw As Long
Dim s As String
s = Range("B8").Value
For Rw = 8 To Present.UsedRange.Rows.Count
s = Range("C8").Value
If Present.Cells(Rw, 2).Value = "" Then Exit For
Sheet6.Cells(8, 3).Value = Present.Cells(Rw, 2).Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Payslip\" & ActiveSheet.Range("C8").Value & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties _
:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Next Rw
End Sub
Bookmarks