lynnnow
11-02-2012, 01:12 AM
I'm using a routine to search for all PDFs in a folder and its subfolder and returning the number of pages in each PDF. Is it possible to get the page size of each PDF? I've looked a lot for a VBA solution but haven't found on. I'm using this for getting the page numbers
For Each FileNameWithPath In ListOfFilenamesWithPath 'FileNameWithPath.Files
T_str = UCase(FileNameWithPath)
If Right(T_str, 4) = ".PDF" Then
Set ac_fi = New Acrobat.AcroPDDoc
ac_fi.Open T_str
Cells(i, 1).Value = Mid(FileNameWithPath, 1, InStrRev(FileNameWithPath, "\", -1, vbTextCompare) - 1)
Cells(i, 2).Value = Mid(FileNameWithPath, InStrRev(FileNameWithPath, "\", -1, vbTextCompare) + 1, Len(FileNameWithPath))
Cells(i, 3).Value = ac_fi.GetNumPages
'Cells(i, 4).Value = ac_fi.GetSize
i = i + 1
ac_fi.Close
Set ac_fi = Nothing
'Columns("A:D").AutoFit
End If
Next FileNameWithPath
For Each FileNameWithPath In ListOfFilenamesWithPath 'FileNameWithPath.Files
T_str = UCase(FileNameWithPath)
If Right(T_str, 4) = ".PDF" Then
Set ac_fi = New Acrobat.AcroPDDoc
ac_fi.Open T_str
Cells(i, 1).Value = Mid(FileNameWithPath, 1, InStrRev(FileNameWithPath, "\", -1, vbTextCompare) - 1)
Cells(i, 2).Value = Mid(FileNameWithPath, InStrRev(FileNameWithPath, "\", -1, vbTextCompare) + 1, Len(FileNameWithPath))
Cells(i, 3).Value = ac_fi.GetNumPages
'Cells(i, 4).Value = ac_fi.GetSize
i = i + 1
ac_fi.Close
Set ac_fi = Nothing
'Columns("A:D").AutoFit
End If
Next FileNameWithPath