Öffnen Sie ein PDF mit VBA in Excel

Ich versuche, alle entsprechenden PDF-Dateien, die sich im selben Verzeichnis wie meine Excel-Arbeitsmappe befinden, mit VBA zu öffnen. Ich habe dem Projekt den Verweis auf die Adobe Acrobat xx.x-Typbibliothek hinzugefügt. Aber wenn ich versuche, das .App-Objekt zu erstellen, wird der Fehler "Laufzeitfehler '429':" angezeigt.

Was vermisse ich?

Hier ist der Code;

Sub ImportNames()
Dim BlrInfoFileList() As String, NbrOfFiles As Integer, FileNameStr As String
Dim X As Integer, pdfApp As AcroApp, pdfDoc As AcroAVDoc


'Find all of the Contact Information PDFs
FileNameStr = Dir(ThisWorkbook.Path & "\*Contact Information.pdf")
NbrOfFiles = 0
Do Until FileNameStr = ""
    NbrOfFiles = NbrOfFiles + 1
    ReDim Preserve BlrInfoFileList(NbrOfFiles)
    BlrInfoFileList(NbrOfFiles) = FileNameStr
    FileNameStr = Dir()
Loop

For X = 1 To NbrOfFiles
    FileNameStr = ThisWorkbook.Path & "\" & BlrInfoFileList(X)
    Set pdfApp = CreateObject("AcroExch.App")
    pdfApp.Hide

    Set pdfDoc = CreateObject("AcroExch.AVDoc")
    pdfDoc.Open FileNameStr, vbNormalFocus

    SendKeys ("^a")
    SendKeys ("^c")
    SendKeys "%{F4}"

    ThisWorkbook.Sheets("Raw Data").Range("A1").Select
    SendKeys ("^v")
    Set pdfApp = Nothing
    Set pdfDoc = Nothing

    'Process Raw Data and Clear the sheet for the next PDF Document
Next X
End Sub

Antworten auf die Frage(4)

Ihre Antwort auf die Frage