Thầy ơi, em có viết đoạn code để xuất từng phiếu lương thành pdf. Em còn thiếu phần cài mật khẩu cho file pdf thì em nhờ thầy giúp với ạ
Sub testpdf()
Dim Phieu_Luong As Worksheet
Dim field_form As Worksheet
Dim i As Long
Dim p As Long
Dim filepdf As Variant
Application.ScreenUpdating = False
Set Phieu_Luong = Sheets("Phieu_luong")
Set field_form = Sheets("Field form")
p = field_form.Range("A1")
For i = 6 To p + 5
ThisWorkbook.Sheets("Phieu_Luong").Range("AD2") = field_form.Cells(i, 2)
Phieu_Luong.Select
filepdf = ThisWorkbook.Path & "\" & field_form.Cells(i, 118) & ".pdf"
ActiveSheet.ExportAsFixedFormat xlTypePDF, filepdf
Next i
Application.ScreenUpdating = False
MsgBox ("DONE")
End Sub
Chào bạn bạn xem function này nhé