试试下面的代码,在网上找的:
Sub pdfpage()
Dim AcroApp As Acrobat.CAcroApp
Dim numPages As Integer
Dim PD1 As Acrobat.CAcroPDDoc
Set AcroApp = CreateObject("AcroExch.App")
Set PD1 = CreateObject("AcroExch.PDDoc")
Dim mydialog As FileDialog
Dim i As Integer, sFile As String
Set mydialog = Application.FileDialog(msoFileDialogFilePicker)
With mydialog
.Filters.Clear '清除所有文件筛选器中的项目
.Filters.Add "所有PDF文件", "*.pdf", 1 '增加筛选器的项目为所有pdf文件
.AllowMultiSelect = True '允许多项选择
.Show
If .SelectedItems.Count = 0 Then
MsgBox "没有选择任何文件!", vbExclamation + vbOKOnly, "提示"
Exit Sub
End If
For i = 1 To .SelectedItems.Count
sFile = .SelectedItems(i)
Range("a" & i) = sFile
PD1.Open (sFile)
Range("b" & i) = PD1.GetNumPages()
PD1.Close
Next
MsgBox "文件处理完毕!" & vbCrLf & vbCrLf & "共处理了 " & .SelectedItems.Count & " 个文件。", vbInformation + vbOKOnly, "提示"
End With
AcroApp.Exit
Set AcroApp = Nothing
Set PD1 = Nothing
End Sub
Excel对PDF就好像鸡同鸭讲,不是一个系统怎么统计?