(VBA)后期绑定的Acrobat类型库(avaoid参考)((VBA) Late Binding

2019-10-29 22:16发布

是否有可能避免参考使用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)

Answer 1:

@ACatinLove感谢! 有效! (我的代码提取物的结果)。 某处,我读了一个应该把“常量AcroExch只要= 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) Late Binding (avaoid reference) of Acrobat Type Library