Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I´m using a macro that sends each monday a weekly report, but has a time problem, first it creates a pdf file on a specific folder then the pdf file is attached to an email and sent. The problem is that it takes about 1 minute for the pdf to be created and at that time the macro already attached the pdf file that was created the l week before.
Is there any way to avoid this problem???
Thanks!
[ code ]
if weekday(ff - 1) = 1 then
printReportPDF "c:\QV\Repositorio\Reportes\Camaras\ve\TempCamaras.pdf"
ActiveDocument.PrintReport "RP02", "QlikViewPDF", FALSE
end if
Set objMail = CreateObject("CDO.Message")
objMail.From =
objMail.To =
objMail.Cc =
objMail.Subject =
objMail.TextBody =
'on error resume next
objMail.AddAttachment "c:\QV\Repositorio\Reportes\Camaras\ve\TempCamaras.pdf"
objMail.send
Set objMail = Nothing
end sub
Function printReportPDF(pdfOutputFile)
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKEY_CURRENT_USER\Software\QlikViewPDF\OutputFile", pdfOutputFile, "REG_SZ"
WSHShell.RegWrite "HKEY_CURRENT_USER\Software\QlikViewPDF\BypassSaveAs", "1", "REG_SZ"
Set WSHShell = nothing
End function
[ /code ]
Why don't you first delete the old pdf?
Rgds,
Joachim
You can try using an API "WaitForIdle" to enforce the sequence of the events.