+ Reply to Thread
Results 1 to 3 of 3

Count number of pages of pdf files in directory by VBA

  1. #1
    Registered User
    Join Date
    11-29-2017
    Location
    belgium
    MS-Off Ver
    Office 365 ProPlus
    Posts
    32

    Count number of pages of pdf files in directory by VBA

    I need to count the total number of pages in a big directory with thousands of pdf files.
    First I need to be sure that the criteria is: pdf of the year 2020, month does no matter. In my code below you can see that I used *_2020_??.pdf what means that any sign before _2020_ may been used and after _2020_ there is again the possibility for 2 digits.

    Background: naming of the pdf files is e.g. 12345_2020_11.pdf what means: name of the file is 12345 of the year 2020 of the month 11.

    I found a code on the internet but it seems not to work. It stops after adding the heading titles File Name and Pages, and then there is no further progress at all or it stops without showing error message.
    Conclusion after testing is: the script is ONLY looking in the root directory, not in subfolders. So I need some help to integrate code to search in all subfolders.


    Please Login or Register  to view this content.
    Last edited by Jesseke; 11-20-2020 at 07:49 AM.

  2. #2
    Registered User
    Join Date
    11-29-2017
    Location
    belgium
    MS-Off Ver
    Office 365 ProPlus
    Posts
    32

    Re: Count number of pages of pdf files in directory by VBA

    During a small test, I notice that this rule

    Please Login or Register  to view this content.
    could be the problem. If I use

    Please Login or Register  to view this content.
    there is no problem at all.
    Concrete example of filename is: 4PAR596264-1B_2020_06.pdf

    The directory I select is also a network drive. I ran the macro/excel on my local workstation and thought that this could maybe the problem. After moving the excel document and rerun the script again, I have the same result. Just the header titles and no progress at all.
    Last edited by Jesseke; 11-20-2020 at 04:35 AM.

  3. #3
    Registered User
    Join Date
    11-29-2017
    Location
    belgium
    MS-Off Ver
    Office 365 ProPlus
    Posts
    32

    Re: Count number of pages of pdf files in directory by VBA

    Conclusion after a new test: the macro is searching in the root selected directory ONLY! Not, in the subdirectories and that's why I receive no result because there are no pdf files in my root directory.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Scan subfolders for PDF files and count pages
    By ISMI in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 10-04-2018, 10:13 AM
  2. Count Rows in all files in a directory
    By dyung in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2016, 05:32 PM
  3. Determine number of files in a dynamic directory
    By desolatori in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2014, 10:23 AM
  4. How can i get the records/rows count of files in a directory
    By anaconte1010 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2013, 12:54 PM
  5. How to count # of .xls files in a directory - I NEED HELP PLEASE
    By anaconte1010 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-10-2013, 12:04 PM
  6. Check Number of Files in Directory
    By dvent in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2007, 10:13 PM
  7. Count files in directory
    By Vlad999 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-21-2006, 07:40 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1