Mình sẽ không in bằng cái microsoft to pdf.
MÌnh thường sử dụng cái này
Sub ClearForm()
Dim sRoot As String, FS
Dim na1, na2 As String
'************************************ Make Folder
On Error Resume Next
sRoot = "D:\DATA\Pdf\" & Format(Now, "dd - mm - yyyy")
Set FS = CreateObject("Scripting.FileSystemObject")
If Not (FS.FolderExists(sRoot)) Then MkDir sRoot
'************************************ Make pdf
na1 = sRoot & "\OUT " & Sheet4.Range("O10") & " " & Format(Now, "ddmmyy") & " " & Format(Now, "hhmm") & ".pdf"
na2 = sRoot & "\IN " & Sheet4.Range("O10") & " " & Format(Now, "ddmmyy") & " " & Format(Now, "hhmm") & ".pdf"
If Sheet4.Range("A5") = 0 Then GoTo NextStep:
If Sheet4.Range("A5") = 1 Then
Sheet4.Range("B2
34").ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
na1, Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End If
1 đoạn của nó thôi nhé
Code chạy ổn. Bạn cần có cái phần save as pdf