KunalTalreja
New Member
Hi,
I am facing problem in vba coding as Run time Error 5,
It gives me the error when converting from excel to pdf
Below is the script
[pre]
[/pre]
I am facing problem in vba coding as Run time Error 5,
It gives me the error when converting from excel to pdf
Below is the script
[pre]
Code:
Option Explicit
Sub Slip()
Dim Cell As Range
Dim Curpath As String
Dim PSFileName As String
Curpath = ActiveWorkbook.Path & ""
For Each Cell In Range("Name")
[salary] = Cell.Value
If (Range("salary")) = Empty Then
Exit Sub
End If
ActiveSheet.Range("A7:E42").ExportAsFixedFormat xlTypePDF, ThisWorkbook.Path & "salaryslip-" & Format(Now, "ddmmyyyy-hhmm") & ".pdf"
Next Cell
End Sub