VBA:Acrobat 运行时错误 429;ActiveX 组件无法创建对象
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28677288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VBA: Acrobat Run time error 429; ActiveX component can't create object
提问by Mariska
I have the following codes to read in contents from a PDF file in Excel VBA:
我有以下代码可以从 Excel VBA 中的 PDF 文件中读取内容:
'Note: A Reference to the Adobe Library must be set in Tools|References!
Dim AcroApp As CAcroApp, AcroAVDoc As CAcroAVDoc, AcroPDDoc As CAcroPDDoc
Dim AcroHiliteList As CAcroHiliteList, AcroTextSelect As CAcroPDTextSelect
Dim PageNumber, PageContent, Content, i, j
Set AcroApp = CreateObject("AcroExch.App")
Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
If AcroAVDoc.Open(strFileName, vbNull) <> True Then Exit Function
' The following While-Wend loop shouldn't be necessary but timing issues may occur.
While AcroAVDoc Is Nothing
Set AcroAVDoc = AcroApp.GetActiveDoc
Wend
Set AcroPDDoc = AcroAVDoc.GetPDDoc
For i = 0 To AcroPDDoc.GetNumPages - 1
Set PageNumber = AcroPDDoc.AcquirePage(i)
Set PageContent = CreateObject("AcroExch.HiliteList")
If PageContent.Add(0, 9000) <> True Then Exit Function
Set AcroTextSelect = PageNumber.CreatePageHilite(PageContent)
' The next line is needed to avoid errors with protected PDFs that can't be read
On Error Resume Next
For j = 0 To AcroTextSelect.GetNumText - 1
Content = Content & AcroTextSelect.GetText(j)
Next j
Next i
ReadAcrobatDocument = Content
AcroAVDoc.Close True
AcroApp.Exit
Set AcroAVDoc = Nothing: Set AcroApp = Nothing
End Function
Sub demo()
Dim str As String
str = ReadAcrobatDocument("C:\Desktop\asdf.pdf")
End Sub
However, I am getting the runtime 429 error at
但是,我收到运行时 429 错误
Set AcroApp = CreateObject("AcroExch.App")
What is wrong? I have Adobe Reader X and the references I've checked are:
怎么了?我有 Adobe Reader X,我检查过的参考资料是:
Acrobat Access 3.0 Type Library AcroBrokerLib AcroIEHelper 1.0 Type Library AcroIEHelperShim 1.0 Type Library Adobe Acrobat Browser Control Type Library 1.0 Adobe Acrobat 10.0 Type Library Adobe Reader File Preview Type Library
Acrobat Access 3.0 类型库 AcroBrokerLib AcroIEHelper 1.0 类型库 AcroIEHelperShim 1.0 类型库 Adobe Acrobat 浏览器控件类型库 1.0 Adobe Acrobat 10.0 类型库 Adobe Reader 文件预览类型库
回答by David Zemens
From the very first result in Google for the search query:
从 Google 中搜索查询的第一个结果开始:
createobject acroexch.app error 429
createobject acroexch.app 错误 429
You cannot do this with Adobe Reader, you need Adobe Acrobat:
您无法使用 Adobe Reader 执行此操作,您需要使用 Adobe Acrobat:
This OLE interface is available with Adobe Acrobat, not Adobe Reader.
此 OLE 界面可用于 Adobe Acrobat,而非 Adobe Reader。