Hi,
i have a function for printing repots in pdf file.
Function PrintReportPDF(oReport, pdfOutputFile)
ActiveDocument.PrintReport oReport, "PDF-XChange 3.0", false
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO. MoveFile "C:\Temp\QlikView Printing.pdf", pdfOutputFile
==> but this leads to a problem, if the destination file already exist, the parameter 'true' won't work.
objFSO. CopyFile "C:\Temp\QlikView Printing.pdf", pdfOutputFile, True
==> the problem: the tempfile QlikView Printing.pdf would not be deleted. If I run the macro a 2nd time, I got the questeion to overwrite. I wan't to avoid some interactions.
If I try to delete the tempfile after CopyFile with:
objFSO. DeleteFile "C:\Temp\QlikView Printing.pdf"
==> I got the errormessage, that the file does not exist. (I think the macro tries to delete the file, before the step before is finished)
End Function
I think, I need an error handling in such a way, that I have to check, wether the destination file exist, then delete it. But since I'm not a programmer, how can I solve it?
Or does someone has a better solution?
best regards
Stefan Bockelmann