I now also tried merging PDFs directly, it worked without an error.
Does this modified sample work for you?
Sub MergedMultipleFiles()
Dim PDFCreatorQueue As Variant
Dim printJob As Variant
Dim oPDF As Variant
Set oPDF = CreateObject("PDFCreator.PDFCreatorObj")
Set PDFCreatorQueue = CreateObject("PDFCreator.JobQueue")
If Not oPDF.IsInstanceRunning Then
MsgBox "Initializing PDFCreator queue..."
PDFCreatorQueue.Initialize
End If
'change path to some existing test files
oPDF.AddFileToQueue "D:\temp\test.pdf"
oPDF.AddFileToQueue "D:\temp\test2.pdf"
'Set printer if necessary
Application.ActivePrinter = "PDFCreator"
MsgBox "Waiting for the 2 jobs to arrive at the queue for 15 seconds..."
If Not PDFCreatorQueue.WaitForJobs(2, 15) Then
MsgBox "The print job did not reach the queue within " & " 15 seconds"
Else
MsgBox "Currently there are " & PDFCreatorQueue.Count & " job(s) in the queue"
MsgBox "Merging all available jobs now"
PDFCreatorQueue.MergeAllJobs
MsgBox "Now there are " & PDFCreatorQueue.Count & " job(s) in the queue"
MsgBox "Getting job instance"
Set printJob = PDFCreatorQueue.NextJob
printJob.SetProfileByGuid ("DefaultGuid")
'change output path as required
printJob.ConvertTo ("D:\temp\output.pdf")
If (Not printJob.IsFinished Or Not printJob.IsSuccessful) Then
MsgBox "Could not convert the file: " & fullPath
Else
MsgBox "Job finished successfully"
End If
End If
MsgBox "Releasing the object"
PDFCreatorQueue.ReleaseCom
End Sub