VB program - only first file created
I have a vb program that creates multiple pdf files from crystal reports. The first print goes correctly and the output is in the specified directory. However the second pdf file never gets created. The program hangs waiting for it to be created. If I look in the temp\PDFCreatore\PDFCreatorSpool directory I see the temp spool file. If I stop the Vb pgm and then start->pgm->PDFCreator, the file will momentarily appear in the list and then go away, and it will no longer be in the PDFCreatorSpool directory. However it does not go to the output directory specified. This is VB6 on Win-XP
Any help on this appreciated.
With PDFCreator1
.cVisible = True
.cStart "/NoProcessingAtStartup"
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = strDIRName
.cOption("AutosaveFilename") = CStr(strFileName)
.cOption("AutosaveFormat") = 0
.cDefaultPrinter = "PDFCreator"
.cClearCache
crpReport1.PageSetup.PaperSize = crPaperLetter
crpReport1.PageSetup.PaperOrientation = iOrin
crpReport1.PrintOut False, 1
' Print the report
.cPrinterStop = False
End With
This is where is will hang on the second file - waiting for the file to get to PDFCreator.
'Wait until the print job has entered the print queue
Do Until PDFCreator1.cCountOfPrintjobs = 1
DoEvents
Sleep 200
Loop
pdfjob.cPrinterStop = False
'Wait until PDF creator is finished then release the objects
Do Until PDFCreator1.cCountOfPrintjobs = 0
DoEvents
Sleep 200
Loop
' Reset the Defalut printer
With PDFCreator1
.cPrinterStop = True
.cDefaultPrinter = DefaultPrinter
Sleep 200
.cClose
End With
First Question is, are the files all opened when you want to PDF? I had made a VBA script for autocad with a similar problem. I closed each file that was handled by the script. Automaticly the next file was current.
I do not see a loop for reading out the filenames. Make that and try again. Good luck. Peter