【发布时间】:2019-12-10 06:02:04
【问题描述】:
我正在尝试通过 VBA 将 Adobe Acrobat 连接到 Excel。目标是获取 PDF 并将其插入 Excel。
Sub Imp_Into_XL(PDF_File As String, Each_Sheet As Boolean)
'This procedure get the PDF data into excel by following way
'1.Open PDF file
'2.Looping through pages
'3.get the each PDF page data into individual _
sheets or single sheet as defined in Each_Sheet Parameter
Dim AC_PD As Acrobat.AcroPDDoc 'access pdf file
Dim AC_Hi As Acrobat.AcroHiliteList 'set selection word count
Dim AC_PG As Acrobat.AcroPDPage 'get the particular page
Dim AC_PGTxt As Acrobat.AcroPDTextSelect 'get the text of selection area
Dim WS_PDF As Worksheet
Dim RW_Ct As Long 'row count
Dim Col_Num As Integer 'column count
Dim Li_Row As Long 'Maximum rows limit for one column
Dim Yes_Fir As Boolean 'to identify beginning of page
Li_Row = Rows.Count
Dim Ct_Page As Long 'count pages in pdf file
Dim i As Long, j As Long, k As Long 'looping variables
Dim T_Str As String
Dim Hld_Txt As Variant 'get PDF total text into array
RW_Ct = 0 'set the intial value
Col_Num = 1 'set the intial value
Application.ScreenUpdating = False
Set AC_PD = New Acrobat.AcroPDDoc 'ERROR LINE HERE
Set AC_Hi = New Acrobat.AcroHiliteList
我收到运行时错误 429:ActiveX 组件无法在设置 AC_PD = New Acrobat.AcroPDDoc 的行上创建对象。我不确定是什么原因造成的。我很确定我有所有正确的参考资料。任何和所有的帮助表示赞赏!
【问题讨论】:
-
当您将
Set AC_PD = New Acrobat.AcroPDDoc替换为Set AC_PD = CreateObject("AcroExch.PDDoc")时会发生什么情况仍然出现错误? -
这也不行,同样的错误,不过还是谢谢你的回复!
-
我能想到几个原因。 1. 您的 Adobe 安装有问题。或 2. 您正在使用 Office PC 工作,并且您的登录名没有足够的权限。
-
可能还有其他原因,但这些是我能立即想到的 2 个......
-
感谢@SiddharthRout!我会尝试用 IT 解决一些问题!