you can use ImageMagick?
ImageMagick – Download
Private Sub tt() Const conType As String = "*.jpg" Dim col As New Collection Dim sFile As String, j As Integer Dim path As String, ext As String ' put the PATH of the jpgs here! path = Environ$("userprofile") & "\documents\" sFile = Dir$(path & conType) Do Until Len(sFile) = 0 j = j + 1 col.Add Item:=sFile, Key:=j & "" sFile = Dir$ Loop For j = 1 To col.Count Call ConvertJpgToPdfUsingMagick(col(j), Replace$(col(j), ".jpg", ".pdf")) Next End Sub Sub ConvertJpgToPdfUsingMagick(ByVal inputImagePath As String, ByVal outputPdfPath As String) 'Dim inputImagePath As String 'Dim outputPdfPath As String Dim command As String ' Set the paths 'inputImagePath = "C:\Path\To\Input\Image.jpg" 'outputPdfPath = "C:\Path\To\Output\Output.pdf" ' Build the command command = "C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\magick.exe convert """ & inputImagePath & """ """ & outputPdfPath & """" ' Execute the command Shell command, vbHide End Sub




Reply With Quote