vba script to batch convert a folder of tiff to one pdf
Posted: 2017-06-09T16:31:54-07:00
I have 10,000 folders, and need to batch convert all tiff files in each folder to one pdf file.
I listed the Source folder directory in the Column A of an Excel file, and list the pdf file name in Column B.
I want to use the VBA to go through each row, and batch convert each folder to one pdf.
I am able to use the following script to convert if the "path" is pointing to one tif file.(like c:\temp\test.tif) I couldn't figure out how to change the script to convert the entire folder to one pdf.
I listed the Source folder directory in the Column A of an Excel file, and list the pdf file name in Column B.
I want to use the VBA to go through each row, and batch convert each folder to one pdf.
I am able to use the following script to convert if the "path" is pointing to one tif file.(like c:\temp\test.tif) I couldn't figure out how to change the script to convert the entire folder to one pdf.
Code: Select all
Sub ConvertPdf()
Dim r As Integer
For r = 1 To 2
Dim Path As String
Dim pdfname As String
Path = ActiveSheet.Cells(r, 1).Value
pdfname = ActiveSheet.Cells(r, 2).Value
Set img = CreateObject("ImageMagickObject.MagickImage.1")
img.Convert Path, pdfname
Next r
End Sub