0

I picked up VBA about a month ago but I've gotten pretty comfortable with it. right now I am trying to export excel data into a pdf with specific fields but that isn't my issue... yet. I cannot get VBA to recognize the correct acrobat.tlb file.

I have no idea what to do and from the research I have done I have been unable to find a solution. This is an issue I have been having for multiple days. I have restarted my computer, excel, adobe. I don't know what to do.

Any help is appreciated.

I am on a work computer which had both Acrobat 2020 Standard and Acrobat Reader installed. From what I looked up I figured that VBA was trying to use Acrobat Reader instead of Acrobat Standard because it kept giving me the "no such interface" error. I deleted Acrobat Reader completely from the computer and recycle bin. But, whenever I select the correct acrobat.tlb file it changes the filepath to the incorrect file which now doesn't even exist. The file associated with Acrobat Reader was in Program Files and the one associated with Acrobat Standard was in Program Files (x86). I can select the correct file from the references window but as soon as I reopen the references window it changes the filepath. I have used a macro to delete the reference from the References list but it will still revert back to the wrong filepath after reopening the references window after I have selected the correct file.

Filepath when choosing file: C:\Program Files (x86)\Adobe\Acrobat 2020\Acrobat\acrobat.tlb enter image description here

Filepath after reopening reference window: C:\Program Files\Adobe\Acrobat DC\Acrobat\acrobat.tlb enter image description here

A box allowing me to select the correct filepath remains at the bottom of the References list but selecting doesn't do anything.

Belly
  • 1
  • 3

2 Answers2

0

Did you try to add the reference using the Guid and version instead of the file path? See also: References using Guid or FilePath You can try to find the guid by browsing the registry or using this code: Find_tlib "acrobat"

Sub Find_tlib(searchkey As String)
    Const HKEY_CLASSES_ROOT = &H80000000
    Dim Result As Long, oReg As Object, Guid As Variant, SubKeys() As Variant, Versions() As Variant, Version As Variant, Values() As Variant, Value As Variant, Types As Variant
    Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
    oReg.EnumKey HKEY_CLASSES_ROOT, "Typelib\", SubKeys
    For Each Guid In SubKeys
        Result = oReg.EnumKey(HKEY_CLASSES_ROOT, "Typelib\" & Guid & "\", Versions)
        If Result = 0 Then
           On Error Resume Next
           For Each Version In Versions
               Result = oReg.GetStringValue(HKEY_CLASSES_ROOT, "Typelib\" & Guid & "\" & Version, "", Value)
               If Result = 0 Then
                  If InStr(LCase(Value), LCase(searchkey)) > 0 Then
                     Debug.Print Guid, "Version " & Version, Value
                  End If
               End If
           Next
           On Error GoTo 0
        End If
    Next
End Sub
hennep
  • 545
  • 4
  • 12
0

Ok so,

My problem was that I was running 64-bit Excel and a 32-bit version of Acrobat Standard. My computer was smarter than me and was trying to find a 64-bit version of acrobat.tlb which is why it kept creating a filepath to Program Files (which is for 64-bit programs) and not Program Files (x86) even though it didn't exist. I fixed this problem by reinstalling Office in its 32-bit form.

Hope this is helpful for anyone else struggling with the same problem.

Belly
  • 1
  • 3