loPDDoc = CREATEOBJECT("AcroExch.PDDoc") * Open the PDF file loPDDoc.Open("C:\SomeDir\SomePDF.PDF") lnPageCount = loPDDoc.GetNumPages - 1 loPDDoc.Close()In your case, you'd probably just put this into some sort of loop, and add the results of lnPageCount to another variable.