اتفضل جرب الكود بالاسفل
CODE
Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
Sub PrintPDF()
Dim FolderPath As String
Dim FileName As String
Dim FilePath As String
FolderPath = "C:\Users\PDF\"
FileName = Dir(FolderPath & "*.pdf")
Do While FileName <> ""
FilePath = FolderPath & FileName
ShellExecute 0, "print", FilePath, vbNullString, vbNullString, 0
Application.Wait (Now + TimeValue("0:00:03"))
FileName = Dir
Loop
Call CloseAdobeReader
End Sub
Sub CloseAdobeReader()
Dim objWMI As Object
Dim objProcess As Object
Dim colProcesses As Object
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
Set colProcesses = objWMI.ExecQuery("Select * from Win32_Process Where Name = 'AcroRd32.exe'")
For Each objProcess In colProcesses
objProcess.Terminate
Next objProcess
Set colProcesses = Nothing
Set objWMI = Nothing
End Sub
قم باستدعاء
CODE
Call PrintPDF
عن طريق اي زر