wer könnte mir bitte mit einem Makro helfen, das mir alle PDF-Dateien eines Ordners druckt.
Vielen Dank im voraus für die Unterstützung.
Gruß Helmut
dim Datei as string
dim Pfad as string
Pfad = "C:\dein\Ordner\"
Cells.Clear
datei = Dir(pfad & "*.pdf")
if Datei "" then
Cells(1, 1).value = pfad
do until datei = ""
Cells(rows.count, 1).End(xlup).offset(1, 0).value = Datei
datei = dir()
Loop
activesheet.printout
end if
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 Main()
Dim strFileName As String
Dim strPath As String
' Pfad mit anpassen...
strPath = "C:\Temp\"
If Right(strPath, 1) "\" Then strPath = strPath & "\"
strFileName = Dir$(strPath & "*.pdf")
Do Until strFileName = vbNullString
Call ShellExecuteA(Application.hwnd, "PRINT", strPath & _
strFileName, vbNullString, vbNullString, SW_HIDE)
DoEvents
strFileName = Dir$
Loop
End Sub
ServusDie erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden
Suche nach den besten AntwortenEntdecke unsere meistgeklickten Beiträge in der Google Suche
Top 100 Threads jetzt ansehen