ngduychien
VIP
Có những lúc chúng ta cần 1 click để chuyển nhanh Sheet đang dùng thành file PDF thì các bạn có thể sử dụng thủ tục sau
Có thể thay đổi để sử dụng cho Word VBA.
Mã:
Sub SaveAsPDF()
Dim WS As Worksheet
Dim FileName As String
Dim FilePath As String
Set WS = ActiveSheet
FileName = "Result PDF"
WS.PageSetup.Orientation = xlPortrait
FilePath = ThisWorkbook.Path
WS.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FilePath & "\" & FileName & ".pdf", _ Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
MsgBox "Completed", vbInformation, ""
End Sub