Sub PrintAllPDFsInFolder()
Dim FolderPath As String
Dim FileName As String
Dim objShell As Object
Dim objFolder As Object
Dim objFile As Object
' フォルダーのパスを指定
FolderPath = ThisWorkbook.Path
' シェルオブジェクトを作成
Set objShell = CreateObject("Shell.Application")
' フォルダーを開く
Set objFolder = objShell.Namespace(ThisWorkbook.Path)
' フォルダー内のすべてのファイルに対して処理を実行
For Each objFile In objFolder.Items
If Right(objFile.Name, 4) = ".pdf" Then
' PDFファイルを印刷
objFolder.ParseName(objFile.Name).InvokeVerbEx ("print")
End If
Next objFile
' オブジェクトを解放
Set objFile = Nothing
Set objFolder = Nothing
Set objShell = Nothing
MsgBox "印刷が完了しました"
End Sub