【问题标题】:Error:' ActiveX Cannot Create Object' When Connecting VBA to Adobe Acrobat将 VBA 连接到 Adob​​e Acrobat 时出现错误:“ActiveX 无法创建对象”
【发布时间】:2019-12-10 06:02:04
【问题描述】:

我正在尝试通过 VBA 将 Adob​​e 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. 您的 Adob​​e 安装有问题。或 2. 您正在使用 Office PC 工作,并且您的登录名没有足够的权限。
  • 可能还有其他原因,但这些是我能立即想到的 2 个......
  • 感谢@SiddharthRout!我会尝试用 IT 解决一些问题!

标签: excel vba adobe acrobat


【解决方案1】:

遇到此问题的任何人的答案都是购买 Adob​​e Acrobat Pro。使用它可以完美运行,因为您只能使用 Pro 获得完全正确的参考。

【讨论】:

    猜你喜欢
    • 2018-12-06
    • 1970-01-01
    • 2017-12-26
    • 2013-08-02
    • 1970-01-01
    • 1970-01-01
    • 2014-06-09
    • 2019-09-06
    • 2012-05-20
    相关资源
    最近更新 更多