Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists (sFile) Then oFSO.deletefile (sFile) End If
Set oFile = oFSO.CreateTextFile(sFile)
oFile.Close
For i=0 to V.count-1 n = V.Item(i).Text n2 = V2.Item(i).Text
ActiveDocument.Fields("PROJECTNAME").Select n ActiveDocument.Fields("SENDEMAILCMD").Select n2
fln= n fln2= n2
sFile2 = "D:\QlikView\src\dev\PPM\pdf\"& n &".pdf" Set oFSO2 = CreateObject("Scripting.FileSystemObject") If oFSO2.FileExists (sFile2) Then oFSO2.deletefile (sFile2) End If
Set oFile = oFSO.OpenTextFile(sFile,8,true) oFile.WriteLicreatne n2 oFile.Close
Set WSHShell = CreateObject("WScript.Shell") RegKey = "HKEY_CURRENT_USER\Software\PDFCreator\Program\" WSHShell.RegWrite RegKey & "UseAutosave", 1 WSHShell.RegWrite RegKey & "AutosaveDirectory","D:\QlikView\src\dev\PPM\pdf\" WSHShell.RegWrite RegKey & "AutosaveFilename", fln ActiveDocument.Sheets("SH01").Activate ActiveDocument.Sheets("SH01").Print ActiveDocument.GetApplication.Sleep 30000 Set WSHShell = nothing Next
set wshShell = CreateObject("Shell.Application")
wshShell.ShellExecute "D:\QlikView\src\dev\PPM\cmd\PMOSendEmail.bat","","","open",1 ActiveDocument.GetApplication.Sleep 15000 ActiveDocument.GetApplication.Quit end sub
- This macro creates a pdf file per selected dimension value (in this case PROJECTNAME) and afterwards sends it by email to the relevant person.
This process has been running without any issue for 1 year but since today the traffic lights are not rendered anymore in the pdf files while all other charts (bars, lines, bubbles, etc) are correctly displayed.
Additional information: if I manually open the QVW on the server and reload it traffic lights are then correctly rendered in the pdf's. The only difference here with the windows task scheduler way is that QVW runs on the foreground while it runs on the background with the bat file execution.