@oleronesoftwares your code does work but just like the other one the doc closes but acrobat stays open?CreateObject("Shell.Application").Namespace(0).ParseName("C:\Users\sola\Documents\dogexport.pdf").InvokeVerb ("Print")
Dim docpath As String
docpath = Me.txtUnboundSafetyCPath
CreateObject("Shell.Application").Namespace(0).ParseName(docpath).InvokeVerb ("Print")
so you want acrobat to close after printing?@oleronesoftwares your code does work but just like the other one the doc closes but acrobat stays open?
so you want acrobat to close after printing?
Private Sub Command22_Click()
Dim vPID As Variant
vPID = Shell("WINWORD.exe ""C:\Users\sola\Documents\focus.docx""", vbNormalFocus)
CreateObject("Shell.Application").Namespace(0).ParseName("C:\Users\sola\Documents\focus.docx").InvokeVerb ("Print")
Call Shell("TaskKill /F /PID " & CStr(vPID), vbHide)
End Sub
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Sub Close_Acrobat_Reader()
Dim hwnd As Long
Dim nRet As Long
Const WM_CLOSE As Long = &H10
hwnd = FindWindow("AcrobatSDIWindow", vbNullString)
If hwnd <> 0 Then nRet = SendMessage(hwnd, WM_CLOSE, 0, 0)
End Sub
Private Sub t()
Dim pdfExe As String
Dim pdfToPrint As String
'set variable to the path of pdfToPrinter.exe
pdfExe = "C:\VI\pdfToPrinter.exe"
'set the path and name of pdf to print
pdfToPrint = Environ$("userprofile") & "\desktop\Now And Forever chords with lyrics by R...pdf"
Shell pdfExe & " " & """" & pdfToPrint & """"
End Sub