@Rafel wrote:
Hi,
I want to merge pdf files throught Excel vba. I have read the documentation and I can merge the pdf files, so it´s OK.The problem is that only works one of two times, the other time the some jobs didn´t arrive at Queue. That happens always 1 of 2 times: the second time, the fourth time... and so on
When this happens, the jobs didn´t arrive, because I get the message "The jobs didn´t arrive" (see code below)If after I merge files, I restart Excel, then It doesn´t happen... but restart Excel every time is no good solution for users
When it doesen´t work (second time, fourth time...), is like the files continue in the Queue. If I try to print directly from excel (directly, not by code) then it appears some files in the PDFCreator memory (see image)
I have installed the latest version 3.2.2
This is the code I have used:
'File names
Const FILE1 As String = "C:\File1.pdf"
Const FILE2 As String = "C:\File2.pdf"
Const MERGED_FILE As String = "C:\Merge.pdf"'declare objects
Dim oQueue As New PDFCreator_COM.Queue
Dim oPdfCreatorObj As New PDFCreator_COM.PdfCreatorObj
Dim oPrintJob As PDFCreator_COM.PrintJob'initialize queue
oQueue.Initialize'add files to queue
oPdfCreatorObj.AddFileToQueue FILE1
oPdfCreatorObj.AddFileToQueue FILE2'wait for jobs for 15 seconds
If oQueue.WaitForJobs(2, 15) = False Then
MsgBox "The jobs didn´t arrive"
oQueue.ReleaseCom
Exit Sub
End If'merge all jobs
oQueue.MergeAllJobs'get the job and print it
Set oPrintJob = oQueue.NextJob
oPrintJob.SetProfileByGuid ("DefaultGuid")
oPrintJob.ConvertTo (MERGED_FILE)'release
oQueue.ReleaseComThanks!
Posts: 1
Participants: 1