VBA macro for merging PDFs with pdf24-DocTool

Home › Forums › General › VBA macro for merging PDFs with pdf24-DocTool

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #64373
    ingeman
    Participant

    Sub PDF24Merge(outPDF As String, a)
    Dim I As Long, s As String, exe As String, q As String

    '************** Change exe path to yours *************************

    exe = Environ("ProgramW6432") & "\PDF24\Pdf24-DocTool.exe"

    If Trim(Environ("ProgramW6432")) = "" Then exe = "C:\Program Files" & "\PDF24\Pdf24-DocTool.exe"

    q = """"
    outPDF = q & outPDF & q

    's = exe & " -join -profile ""default/good"" -outPutFile " & outPDF & " "
    s = exe & " -join -profile -compress ""default/good"" -noProgress -outputFile " & outPDF & " "

    For I = LBound(a) To UBound(a)
    a(I) = q & a(I) & q
    Next I

    s = s & Join(a, " ")
    'Debug.Print s
    'MsgBox s

    Shell s, vbHide

    'Call CompressPDF(outPDF)

    End Sub

    I am running Windows 10 32bit with PDF24 installed

    The above are in VBA excel code.

    But after last update i do not manish anylonger to Merge all the files in a to one PDF file ?

    What can be reasons and a solutions to have it work again ?

    #64678
    PDF24 Support
    Moderator

    Hello,

    the problem is the order in your command line. After -profile the DocTool expects the profile name. In -profile -compress ""default/good"", -compress is taken as the profile name and default/good as one of the files to join. There is no profile with the name -compress, so the DocTool opens the window for selecting a profile and waits there. Because Excel starts the DocTool with vbHide, you may not see this window.

    Please put ""default/good"" directly after -profile again and remove -compress, as in the line you commented out above it.

    -join and -compress cannot be combined in one call. If both are given, the DocTool only compresses. To compress the joined file, call the DocTool a second time with -compress, -outputFile and the joined file, after the join has finished. Please note that Shell in VBA does not wait for the DocTool to finish.

    The options are described in the manual:

    Since version 11.31.0 there is also the option -silent. The DocTool then shows no windows, and errors such as an unknown profile or a missing file end the DocTool with an exit code instead of waiting for input: https://creator.pdf24.org/manual/11/#11119-exit-codes. Version 11.31.1 is also available for 32-bit Windows.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.