ich suche nach einer Lösung aus einem Makro heraus alle vorhandenen *.pdf Dokumente in Ordner xx zu drucken.
Kann mir da jemand helfen?
Gruß
Mike
### ok für 1 pdf ###
Const ARead As String = "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"
Const Pfad As String = "c:\temp\"
Sub T_1()
f = Dir(Pfad & "*.pdf")
lng = Shell(ARead & " /n /h /t " & Pfad & f)
Debug.Print lng
End Sub
oder
http://www.office-loesung. _
de/p/viewtopic.php?f=166&t=811033
Option Explicit
Private Declare PtrSafe Function ShellExecuteA Lib "shell32.dll" ( _
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
Private Const SW_HIDE As Long = 0
Public Sub PrintPDF()
Const FOLDER_PATH As String = "G:\Test\" 'Pfad anpassen !!!
Dim objCell As Range
Dim strFileName As String
With Worksheets("Tabelle1") 'Tabellennamen anpassen !!!
For Each objCell In .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlUp))
If Not IsEmpty(objCell.Value) Then
strFileName = Dir$(FOLDER_PATH & objCell.Value & "*.pdf")
Do Until strFileName = vbNullString
Call ShellExecuteA(Application.hwnd, "PRINT", FOLDER_PATH & _
strFileName, vbNullString, vbNullString, SW_HIDE)
DoEvents
strFileName = Dir$
Loop
End If
Next
End With
End Sub
Der 2. Code ist (glaube ich) von Nepumuk.