I'm trying to merge multiple access report (exported as single PDF) to one single PDF.
I found a great help on this forum with some code (sorry I don't remember the author of the post, it was posted for Excel), and I set the code to work with my "problem".
It seems to work fine: I've 3 PDFs (in this case 3 single pages PDF) to merge to 1, and it does it, I get a single PDF (3 pages)
Then I deleted this new created file and re-run the routine, but instead to get once again the merged one (3 pages) I get a single PDF but with only the first PDF inside (1 page)
If I delete this new file and re-run again the routine, I get the right file (3 pages); but if I delete that file and re-run, I get the single page again. And so on.....
Practically: during the "odd-merging" I get the right ones, during the "even-merging" I get the wrong ones
I don't understand why.....
Thanks for any advice
Here comes the code (the part of the code where I define all the vars is working fine so I omitted that part):
Dim oPDF As PdfCreatorObj
Set oPDF = Nothing
Set oPDF = New PdfCreatorObj
'On Error GoTo EndSub ' this is commented out for debuging purposes
Dim q As PDFCreator_COM.Queue
Set q = New PDFCreator_COM.Queue
Debug.Print "oPDF isinstancerunning: " & oPDF.IsInstanceRunning ' close Excel and open if true.
q.WaitForJobs 2, 5
Debug.Print "q.Count: " & q.Count ' here it prints either 1 or 2. Should always be 2.
Dim job As PDFCreator_COM.PrintJob
While q.Count > 0
Set job = q.NextJob
job.ConvertTo (sPDFPath & "\" & sPDFName)
Debug.Print "q.Count3: " & q.Count