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 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