Hi all,
I'm not good in VBA, I got below script from internet to count pdf pages in folder (with Acrobat Pro), but not count pages inside sub-folders, can you help me to count pdf pages in all sub-folders
Thanks
I'm not good in VBA, I got below script from internet to count pdf pages in folder (with Acrobat Pro), but not count pages inside sub-folders, can you help me to count pdf pages in all sub-folders
Thanks
VBA Code:
Sub GetPDFNumberOfPages()
Dim FSO As Object
Dim F_Fol As Object
Dim F_File As Object
Dim T_Str As String
Dim Dlg_Fol As FileDialog
'In VBE, add reference: Tools > References... > Acrobat > OK
Dim Ac_Fi As Acrobat.AcroPDDoc
Dim i As Long
Set Dlg_Fol = Application.FileDialog(msoFileDialogFolderPicker)
If Dlg_Fol.Show = -1 Then
T_Str = Dlg_Fol.SelectedItems(1)
Else: Set Dlg_Fol = Nothing
End If
Set Dlg_Fol = Nothing
Set FSO = CreateObject("Scripting.FileSystemObject")
Set F_Fol = FSO.getfolder(T_Str)
i = 2
For Each F_File In F_Fol.Files
T_Str = UCase(F_File.Path)
If Right(T_Str, 4) = ".PDF" Then
Set Ac_Fi = New Acrobat.AcroPDDoc
Ac_Fi.Open T_Str
Cells(i, 1).Value = T_Str
Cells(i, 2).Value = Ac_Fi.GetNumPages
i = i + 1
Ac_Fi.Close
Set Ac_Fi = Nothing
End If
Next
Range("A:B").Columns.AutoFit
Set F_File = Nothing
Set F_Fol = Nothing
Set FSO = Nothing
End Sub