ninhnammin
Yêu THVBA
e đang gặp sự cố như vầy, nếu e xuất file .xlsx thì ra file riêng có dữ liệu mở file được ok, còn nếu e sửa lại thành .pdf thì vba vẫn xuất ra file nhưng e mở file lên thì lại báo là không có dữ liệu, em xin chỉ giáo!
Mã:
Sub taods()
Dim i As Integer
'giá tr? ??u tiên;
i = 13
'quét tung nhân viên;
With ThisWorkbook.Sheets("DULIEU")
While (.Cells(i, 2) <> "")
'gan ma cho tung NV:
ThisWorkbook.Sheets("XUATLUONG").Cells(1, 11) = .Cells(i, 2)
'trich xuat sheet form ra file moi'
ThisWorkbook.Sheets("XUATLUONG").Copy
'luu cai file sau khi trich xuat vao folder danh sach va dat mat khau'
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\danh sach\" & .Cells(i, 2) & "_" & .Cells(i, 3) & ".PDF", Password:=.Cells(i, 12)
ActiveWorkbook.Close
i = i + 1
Wend
End With
End Sub