VBA Code to Send Pay Slip automatic from Folder

kumar lama

Board Regular
Joined
May 20, 2014
Messages
85
I have Pay slip in one folder "C:\Users\ABC\Desktop\All My Desktop File\SS\Salary File\Staff\6. Oct-14\PaySlip"
I have one Excel File sheet 1 which has all employees Name (Column "A: A") All Name are match with folder pays lip name and Column "B: B" has email address.

So is there any way to send pay slip automatic by outlook? I think there are some VBA Code to do it. And all my Payslip are in PDF. I am using VBA code to save as PDF.
Code are like below.
Option Explicit

Public Sub SaveAsPdf()
Dim lStart As Long
Dim lEnd As Long
Dim l As Long
Dim rngSlipNumber As Range


With Sheet5
Set rngSlipNumber = .Range("AJ1")
lStart = .Range("Ak1") ' indicates starting Sr num
lEnd = .Range("Ak2") ' indicates ending Sr num


For l = lStart To lEnd
rngSlipNumber.Value = l
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=.Range(" AI1") & "-" & "Mr. " & .Range("D8") & " " & .Range(" AR1").Value, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next l
End With
End Sub
 
i have excel data of salary sheet, I want to send pdf of each data as payslip through outlook in pdf format.
I want to send each employee's payslip in pdf format. I have excel salary data and transferring to word through mail merge. Output of Each employee payslip is in HTML or attachment. I want to send each data in pdf format.
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top