VBA Run Time Error 48 Error in loading DLL

VBA learner ITG

Active Member
Joined
Apr 18, 2017
Messages
272
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi Peers,

Can I please get your advice as to why I am getting the above error code when I try to run the below macro which is stopping at this line of code:

I have a licensed version of Adobe Pro DC installed and checked there are no other Adobe readers etc. Also I have made sure the VBA reference Library has the required references.

I have searched different sites and unsure how to approach this.


Screenshot 2021-08-25 131732.jpg







VBA Code:
Public Sub Merge_PDFs_v2()
    Dim strFileExists As String
    Dim PDFfiles As Variant
    Dim i As Long
    Dim objCAcroPDDocDestination As Acrobat.CAcroPDDoc
    Dim objCAcroPDDocSource As Acrobat.CAcroPDDoc
    ExOffset = 1
    
    Sheets("PDF Maker").Activate
    Range("B2").Select
    ActiveCell.FormulaR1C1 = _
        "=IFERROR(@IF(COUNTIF(R2C1:RC[-1],@ultimatelookup(R1C1,R[-1]C,'Store Grades'!R3C3:R3C10,0,1,2))>0,"""",ultimatelookup(R1C1,R[-1]C,'Store Grades'!R3C3:R3C10,0,1,2)),"""")"
    Range("B3").Select
    Calculate
   
    Sheets("Exceptions").Range("A2:B5000").ClearContents
    
    Sheets("PDF Files").Visible = True
    Sheets("PDF Files").Activate
    With ActiveSheet
        RowCount = Range("W1").Value + 1
        RowRange = "A2:S" & RowCount
        PDFfiles = Range(RowRange)
    End With
   
   
    Set objCAcroPDDocDestination = CreateObject("AcroExch.PDDoc")
    Set objCAcroPDDocSource = CreateObject("AcroExch.PDDoc")
   
    'Loop through rows, open PDF file in column A, open and insert PDF file in column B, save as PDF file in column C
   
    For i = 1 To UBound(PDFfiles)
    ExpFilePath = PDFfiles(i, 17)
    siteN = PDFfiles(i, 16)
    siteC = PDFfiles(i, 19)
    deptN = Sheets("PDF Files").Range("U1").Value
    deptC = Sheets("PDF Files").Range("U2").Value
    outputfile = ExpFilePath & Format(deptC, "00000") & "#" & siteC & "#" & siteN & ".pdf" ' The name of the merged file
    sourceopen = 0
    destopen = 0
        For j = 1 To 15
            fname = PDFfiles(i, j)
            If Len(PDFfiles(i, j)) = 0 Then
                j = 15
            Else
                strFileExists = Dir(fname)
                If strFileExists = "" Then
                    'MsgBox "The selected file doesn't exist"
                    Sheets("Exceptions").Range("A1").Offset(ExOffset, 0).Value = siteN
                    Sheets("Exceptions").Range("A1").Offset(ExOffset, 1).Value = fname
                    ExOffset = ExOffset + 1
                Else
                    'MsgBox "The selected file exists"
                    If sourceopen = 0 Then
                        objCAcroPDDocDestination.Open PDFfiles(i, 1)
                        sourceopen = 1
                    Else
                        objCAcroPDDocSource.Open PDFfiles(i, j)
                        destopen = destopen + 1
                        totalopen = destopen + sourceopen
                        If Not objCAcroPDDocDestination.InsertPages(objCAcroPDDocDestination.GetNumPages - 1, objCAcroPDDocSource, 0, objCAcroPDDocSource.GetNumPages, 0) Then
                            MsgBox "Error merging" & vbCrLf & PDFfiles(i, 1) & vbCrLf & "and" & vbCrLf & PDFfiles(i, 2), vbExclamation
                        End If
                        objCAcroPDDocSource.Close
                    End If
                End If
            End If
        Next
        Debug.Print outputfile
        objCAcroPDDocDestination.Save 1, outputfile
        objCAcroPDDocDestination.Close
    Next
    Set objCAcroPDDocSource = Nothing
    Set objCAcroPDDocDestination = Nothing
    MsgBox "Done"
    Sheets("PDF Files").Visible = False
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
You are mixing early and late binding. I am no expert in this field but maybe the create object method refers to a different library Acroexch vs. Acrobat in the early binding.
 
Upvote 0
You are mixing early and late binding. I am no expert in this field but maybe the create object method refers to a different library Acroexch vs. Acrobat in the early binding.

Thank you for looking at my post.

I finally found the solution to my issue:

Because I installed 32 bit Adobe and I have running on my machine 64 bit Excel.
So I had to uninstall adobe 32 and install Adobe 64 bit for it to work.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top