(VBA)Acrobat类型库的后期绑定(避免引用)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(VBA)Acrobat类型库的后期绑定(避免引用)相关的知识,希望对你有一定的参考价值。

有可能以某种方式避免引用Adobe Acrobat类型库吗?我无法弄清楚如何...我收到一条ActiveX错误消息。

我只粘贴我的代码的摘录,因为其余的并不重要。这是具有早期绑定的代码(设置引用):

Dim Fol_Path As String
Dim Each_Page As Boolean

Dim AC_PD As Acrobat.AcroPDDoc
Dim AC_Hi As Acrobat.AcroHiliteList
Dim AC_PG As Acrobat.AcroPDPage
Dim AC_PGTxt As Acrobat.AcroPDTextSelect

Dim OS_FSO As Object
Dim OS_TxtFile As Object

Set OS_FSO = CreateObject("Scripting.filesystemobject")

Dim Ct_Page As Long
Dim i As Long, j As Long, k As Long
Dim T_Str As String

Dim Hld_Txt As Variant

Each_Page = True

Set AC_PD = New Acrobat.AcroPDDoc
Set AC_Hi = New Acrobat.AcroHiliteList
AC_Hi.Add 0, 32767

... ... ...

        Set AC_PG = .AcquirePage(i - 1)

        Set AC_PGTxt = AC_PG.CreateWordHilite(AC_Hi)
答案

@ACatinLove谢谢!有效! (我的代码提取结果)。在某处,我读到在昏暗之后应该把“Const AcroExch As Long = 0”,为什么会这样?

Dim AC_PD As Object
Dim AC_Hi As Object
Dim AC_PG As Object
Dim AC_PGTxt As Object

'Const AcroExch As Long = 0

Dim OS_FSO As Object
Dim OS_TxtFile As Object

Set OS_FSO = CreateObject("Scripting.filesystemobject")

Dim Ct_Page As Long
Dim i As Long, j As Long, k As Long
Dim T_Str As String

Dim Hld_Txt As Variant

Each_Page = True

'Set AC_PD = New Acrobat.AcroPDDoc
'Set AC_Hi = New Acrobat.AcroHiliteList

Set AC_PD = CreateObject("AcroExch.PDDoc")
Set AC_Hi = CreateObject("AcroExch.HiliteList")

以上是关于(VBA)Acrobat类型库的后期绑定(避免引用)的主要内容,如果未能解决你的问题,请参考以下文章

VBA字典

VBA:只有在公共对象模块中定义的用户定义类型才能被强制转换为变体或从变体强制转换或传递给后期绑定函数

通过 VBA 发送具有后期绑定错误的电子邮件

.net CLR 在 VBA (Access) 中的后期绑定

Excel VBA 宏后期绑定

无法在 Excel 2007 VBA 中使用 Option Strict Off 进行后期绑定