Macro to Create a PDF file from a Worksheet in Excel


Create a PDF file from a Worksheet


Sub CreatePdf()
Dim ID As String
ID = Range("D4").Text
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="E:\Payslip\" + ID + ".pdf", _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub

Leave a Reply

Your email address will not be published.Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.